The goal of geomarker is to facilitate geomarker assessment, or the linkage of environmental exposures and community characteristics with people according to their locations and dates, in R.
You can install the development version of geomarker from GitHub:
devtools::install_github("geomarker-io/geomarker")The s2cd vector class extends s2::s2_cell to include a list of Date vectors, one for each s2 cell.
This vector is meant to store locations and dates of observations and is used as the input to all geomarker assessment functions.
S2 is a spherical hierarchical cell index: specifically, a quad-based discrete global grid system (DGGS) on the sphere, while the S2 cell ID system is the 64-bit naming scheme that identifies each cell and its resolution within that grid. BigQuery exposes this system through its S2 geography functions.
For geomarker, a full-resolution (level 30) s2_cell can be treated as a point with an approximate spatial resolution of 1 centimeter, although coarser cells can represent regions—for example, when installing a fixture for a level-6 S2 cell.
Traditional longitude and latitude coordinates can be converted to full-resolution S2 cells with s2::as_s2_cell(s2::s2_lnglat(lon, lat)).
Use the S2 Cell Viewer to inspect individual cells and the S2 Region Coverer to explore coarser cells and regional coverings.
| geomarker | geomarker function |
|---|---|
| 🌦️ weather and atmospheric conditions | get_gridmet_data(), get_narr_data() |
| 🔥 wildfire smoke | get_daily_smoke_data(), get_smoke_summary() |
| 🌿 satellite-based vegetation and greenness | get_evi_data() |
| ⛰️ elevation | get_elevation_summary() |
| 🏙️ land cover and imperviousness | get_nlcd_fct_imp_data() |
| 🚦 traffic | get_traffic_summary() |
| 🏭 point-source emissions | get_nei_point_summary() |
| 🌫️ MERRA-2 surface PM2.5 | get_merra_data() |
| 🗺️ Census block group linkage | s2_join_tiger_bg() |
Most data required for geomarker assessment does not come with the package, but is installed on first use by downloading (and pre-processing) source data to the geomarker package's user data directory (see tools::R_user_dir()).
This means it is available to use again across other R sessions and projects by the same user and will not need to be downloaded more than once.
geomarker_download_file() is the common download and cache layer that powers most of the package's data assets: it gives each source URL a stable local filename (using an ETag when available), stores the file in geomarker_data_dir(), and reuses the cached copy in later assessments.
The same cache contract makes it possible to prepare data in advance for a specific level-6 S2 cell and date range.
The source-specific install_*_geomarker_fixture() helpers download and spatially subset the required assets into an inst/gmrkr--<cell>/R/geomarker directory; see inst/install_cincy_geomarker_fixture.R for a complete example.
For assessments that summarize within a buffer, the corresponding fixture installer accepts a buffer in meters and includes that halo around the level-6 fixture cell.
Set it to the largest buffer that the prepared fixture must support; each installer defaults to the assessment function's default buffer.
A fixture for the Cincinnati-area cell 8841 is included with geomarker.
To use it without downloading from the original sources, set R_USER_DATA_DIR to system.file("gmrkr--8841", package = "geomarker") and set R_GEOMARKER_NO_DOWNLOAD=true.
This pattern can also be used to package data for another study region first and then run geomarker assessments from those prepared assets when source downloads are unavailable, restricted, slow, or otherwise not preferable.
MERRA-2 PM2.5 release data are cataloged in inst/merra-data.dcf as complete half-year assets: January through June (H1) and July through December (H2).
Assets are added to the package's provisional v0.0.1 GitHub release only after every expected daily granule has been discovered and validated.
There is one fixed asset name for each year and half-year. It may be recreated from the latest NASA data while preparing a package release, but the checked-in DCF records exactly one published file and checksum. A later data correction is distributed with a new package and GitHub release.
get_merra_data() first uses a complete monthly artifact built in the user's geomarker data directory and then tries the matching official half-year release.
When neither is present, it returns aligned missing values with one warning rather than substituting an older period.
A user with an Earthdata Login can build any fully elapsed and fully available month directly from NASA. Set the account username and password:
Sys.setenv(EARTHDATA_USER = "...", EARTHDATA_PASSWORD = "...")
install_merra_data("2026-07", source = "earthdata")The source build discovers the exact daily M2T1NXAER v5.12.4 granules through NASA CMR, downloads authenticated variable-and-CONUS subsets, caches daily work for resumption, and writes an adjacent DCF with exact granule revisions and subset hashes.
Set overwrite = TRUE to recreate a month from the latest CMR listing; daily caches whose source granule revision and hash still match are reused.
This is a manual, potentially large build intended for an HPC or similarly provisioned environment; ordinary package checks do not contact NASA.
The bundled Cincinnati MERRA fixtures use deterministic synthetic concentrations solely to exercise the offline API and both half-year branches. They are not scientific data and must not be used for analysis.