raster_ingester#
Raster ingestion from VRT sources (e.g. USGS 3DEP) via window reads.
Functions#
|
Download a raster window from a VRT and save as a Cloud Optimized GeoTIFF. |
|
Fetch raster windows from a VRT and save one COG per admin unit. |
Module Contents#
- openplaces.io.raster_ingester.fetch_raster_from_vrt(boundary: geopandas.GeoDataFrame, output_path: str | pathlib.Path, vrt_url: str, nodata: int | float | None = None) pathlib.Path#
Download a raster window from a VRT and save as a Cloud Optimized GeoTIFF.
Reads directly from the source VRT via window reads — no temporary file on disk. The raster is kept in its native CRS and dtype; if the input geometry is in a different CRS it is reprojected to match the raster.
Nodata resolution order:
nodataargument →src.nodata→ dtype sentinel (max for unsigned int, min for signed int, NaN for float).- Parameters:
boundary – Clipping boundary. Must have a valid CRS.
output_path – Destination path for the output COG (parent dirs must exist).
vrt_url – URL or path of the source VRT (e.g.
s3://prd-tnm/...).nodata – Override nodata value. If None, the source nodata or a dtype-based sentinel is used.
- Returns:
Resolved path of the saved COG.
- Return type:
Path
- openplaces.io.raster_ingester.fetch_rasters_by_admin(ingester) None#
Fetch raster windows from a VRT and save one COG per admin unit.
Called by Ingester._ingest_download_partition when
recipe['dataset'].is_rasteris True.- Parameters:
ingester – openplaces.io.ingester.Ingester instance with resolved
admin_ids_to_processanddownload_partition.