Data sources¶
All sources are free and need no API key or account.
USGS 3DEP DEMs¶
The National Map, United States only. Resolutions 1m, 10m, 30m, and
5m-ak (Alaska IFSAR).
earthfetch.usgs.search_dem ¶
Find 3DEP DEM tiles intersecting a bbox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox
|
(min_lon, min_lat, max_lon, max_lat) in WGS84 degrees.
|
|
required |
resolution
|
one of ``DEM_DATASETS`` keys ("1m", "10m", "30m", "5m-ak").
|
|
'10m'
|
max_items
|
cap on returned tiles.
|
|
100
|
Returns:
| Type | Description |
|---|---|
list of dict
|
Product dicts with |
Source code in src/earthfetch/usgs.py
earthfetch.usgs.download_dem ¶
download_dem(bbox: Sequence[float], resolution: str = '10m', out_dir: str | PathLike | None = None, max_items: int = 100, overwrite: bool = False, workers: int = 4, progress: ProgressFn | None = None) -> list[Path]
Download DEM tiles covering a bbox in parallel. Returns local paths.
Tiles already on disk are skipped, so calls are resumable. out_dir
defaults to the earthfetch cache. Raises TileNotFoundError when no
tiles cover the bbox (e.g. outside the US — try Copernicus instead).
Source code in src/earthfetch/usgs.py
Copernicus GLO-30¶
Global 30 m DEM on AWS Open Data. Used automatically as the fallback outside the US.
earthfetch.copernicus.copernicus_dem_urls ¶
COG URLs for GLO-30 tiles covering a bbox. Ocean-only tiles are absent from the bucket and are silently skipped (checked via HEAD).
Raises TileNotFoundError when no tile exists (open ocean).
Source code in src/earthfetch/copernicus.py
Sentinel-2 L2A¶
Multispectral imagery, global, via the Earth Search STAC API. Bands are
addressed by ESA id (B04, B08, SCL, TCI, ...).
earthfetch.sentinel.search_sentinel2 ¶
search_sentinel2(bbox: Sequence[float], start: str, end: str, max_cloud: float = 20.0, limit: int = 50) -> list[dict]
Search Sentinel-2 L2A scenes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox
|
(min_lon, min_lat, max_lon, max_lat) in WGS84 degrees.
|
|
required |
start
|
ISO dates, e.g. "2026-05-01" / "2026-06-01".
|
|
required |
end
|
ISO dates, e.g. "2026-05-01" / "2026-06-01".
|
|
required |
max_cloud
|
maximum scene cloud cover percent.
|
|
20.0
|
limit
|
cap on returned scenes.
|
|
50
|
Returns:
| Type | Description |
|---|---|
list of dict
|
STAC item dicts sorted by cloud cover (clearest first). Each has
|
Source code in src/earthfetch/sentinel.py
earthfetch.sentinel.clearest_scene ¶
The least-cloudy scene in a date range, or raise NoScenesError.
Source code in src/earthfetch/sentinel.py
earthfetch.sentinel.covering_scenes ¶
covering_scenes(bbox: Sequence[float], start: str, end: str, max_cloud: float = 20.0, limit: int = 100, grid: int = 16) -> list[dict]
Clearest scenes whose footprints together cover the whole bbox.
clearest_scene returns a single scene, which may only partially cover
an AOI that straddles Sentinel-2 tile boundaries. This walks scenes
clearest-first and keeps each one that adds coverage until the bbox is
filled — so the mosaic is built from the clearest available scenes. Feed
the result to load_sentinel2(items=...).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox
|
(min_lon, min_lat, max_lon, max_lat) in WGS84 degrees.
|
|
required |
start
|
ISO dates bounding the search.
|
|
required |
end
|
ISO dates bounding the search.
|
|
required |
max_cloud
|
maximum scene cloud cover percent.
|
|
20.0
|
limit
|
cap on scenes considered.
|
|
100
|
grid
|
coverage-test resolution (grid x grid sample points over the bbox).
|
|
16
|
Returns:
| Type | Description |
|---|---|
list of dict
|
Selected STAC items, clearest first. Raises |
Source code in src/earthfetch/sentinel.py
earthfetch.sentinel.download_sentinel2 ¶
download_sentinel2(item: dict, bands: Sequence[str] = ('B04', 'B03', 'B02'), out_dir: str | PathLike | None = None, overwrite: bool = False, workers: int = 4, progress: ProgressFn | None = None) -> dict[str, Path]
Download selected bands of one STAC item as GeoTIFFs, in parallel.
bands accepts ESA ids ("B04", "B08", "TCI", "SCL") or Earth Search
asset keys ("red", "nir", "visual"). Files land in
out_dir/<scene id>/ (cache dir by default). Returns {band: path}.
Source code in src/earthfetch/sentinel.py
Landsat 8/9¶
Collection-2 Level-2 surface reflectance, global, via Microsoft Planetary
Computer (zero-key). Band labels are normalized to their Sentinel-2
equivalents (red→B04, nir→B08, ...), so the indices and band presets
work identically to Sentinel-2. Also available as composite(...,
source="landsat").
earthfetch.landsat.search_landsat ¶
search_landsat(bbox: Sequence[float], start: str, end: str, max_cloud: float = 20.0, limit: int = 50) -> list[dict]
Search Landsat 8/9 Collection-2 L2 scenes, clearest first.
Source code in src/earthfetch/landsat.py
earthfetch.landsat.load_landsat ¶
load_landsat(bbox: Sequence[float], bands: Sequence[str] = ('red', 'green', 'blue'), crs: str = 'EPSG:4326', res: float | None = None, item: dict | None = None, items: Sequence[dict] | None = None, start: str | None = None, end: str | None = None, max_cloud: float = 20.0, scale: bool = True) -> xarray.DataArray
Load Landsat 8/9 bands for a bbox as one aligned DataArray.
Accepts a single item, a list of items, or start/end dates
(the clearest scene is used). Bands may be common names (red, nir,
swir1), Landsat ids (B4), Sentinel ids (B04), or a preset
("true_color"). Output band labels are the Sentinel-2 equivalents so
indices work unchanged. scale=True returns surface reflectance (0..1).
Source code in src/earthfetch/landsat.py
NAIP aerial imagery¶
0.6-1 m natural-color/near-infrared aerial photos, US only, via Microsoft Planetary Computer. Anonymous SAS tokens are fetched automatically.
earthfetch.naip.search_naip ¶
NAIP STAC items covering a bbox, newest first.
year pins a specific survey year; default returns all years
(callers usually keep the newest tile per footprint).