Skip to content

NewGraphEnvironment/stac_dem_bc

Repository files navigation

stac_dem_bc

status files api

The goal of stac_dem_bc is to serve British Columbia’s LidarBC digital elevation model collection (~58,000 GeoTIFFs hosted on the provincial objectstore) as a SpatioTemporal Asset Catalog (STAC), queryable by location and time via the rstac R package, QGIS (v3.42+), or any STAC-compliant client. The API endpoint is https://images.a11s.one.


The build pipeline lives under scripts/ — a six-step flow (fetch → validate-access → collection-create → item-create → item-validate → s3-sync) that turns the raw provincial GeoTIFF URLs into a searchable pgstac catalog. See the scripts README for the pipeline walkthrough; key concepts (COG, STAC, pgstac, date extraction from filenames, validation caching for incremental rebuilds) are explained there in plain language.



Query the collection

Use bcdata to define an area of interest, then query the stac-dem-bc collection for DEM tiles intersecting it. Below: all DEMs covering the Bulkley River watershed group between 2018 and 2020.

aoi <- bcdata::bcdc_query_geodata("freshwater-atlas-watershed-groups") |>
  bcdata::filter(WATERSHED_GROUP_NAME == "Bulkley River") |>
  bcdata::collect() |>
  sf::st_transform(crs = 4326)

date_start <- "2018-01-01T00:00:00Z"
date_end <- "2020-12-31T00:00:00Z"

# use rstac to query the collection
q <- rstac::stac("https://images.a11s.one/") |>
  rstac::stac_search(
    collections = "stac-dem-bc",
    intersects = jsonlite::fromJSON(
      geojsonsf::sf_geojson(
        aoi, atomise = TRUE, simplify = FALSE
      ),
      simplifyVector = FALSE
    ) |> (\(x) x$geometry)(),
    datetime = paste0(date_start, "/", date_end)
  ) |>
  rstac::post_request()

# get details of the items
r <- q |>
  rstac::items_fetch()

# burn the results locally so we can serve it instantly on index.html builds
saveRDS(r, "data/stac_result.rds")
r <- readRDS("data/stac_result.rds")
# build the table to display the info
tab <- tibble::tibble(
  url_download = purrr::map_chr(r$features, ~ purrr::pluck(.x, "assets", "image", "href"))
)

Please see http://www.newgraphenvironment.com/stac_dem_bc for the published table of collection links.

QGIS Data Source Manager (v3.42+)

QGIS 3.42 added native STAC support — connect directly to the catalog and filter by the current map view. See Lutra Consulting’s STAC-in-QGIS blog post for a walk-through.

Connecting to https://images.a11s.one

Connecting to https://images.a11s.one

Using the field of view in QGIS to filter results

Using the field of view in QGIS to filter results

Sister collections on the same endpoint

The same images.a11s.one STAC API serves several complementary BC collections:

Roadmap

  • uv-based Python dependency management (#16) — migrate from conda to uv for faster, more reproducible Python environments.
  • Structured logging + performance benchmarking (#6) — instrument the pipeline so build performance is quantifiable across runs.
  • True footprint geometry (#2) — recalculate per-item footprints to exclude no-data pixels rather than using bounding boxes; gives accurate spatial-overlap queries.
  • Validation-failure triage (#11) — STACError on specific item JSONs; underlying root cause + automated retry.

Browse open issues for the full backlog.

License

MIT.

About

STAC catalog serving British Columbia's LidarBC DEM collection (~58k GeoTIFFs). Queryable by location and time via rstac, QGIS 3.42+, or any STAC client at images.a11s.one.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages