OpenAerialMap#
- class torchgeo.datasets.OpenAerialMap(paths='data', crs=None, res=None, bbox=None, zoom=19, max_items=1, transforms=None, cache=True, download=False, image_id=None, tile_size=256)[source]#
Bases:
RasterDatasetOpenAerialMap dataset.
The OpenAerialMap (OAM) is an open service for accessing and sharing aerial imagery. The dataset provides access to crowd-sourced aerial imagery from various sources including drones, satellites, and aircraft.
This implementation uses the STAC API to query imagery and download tiles via TMS endpoints. The STAC API returns imagery sorted by most recent first.
Dataset features#
Aerial imagery from various sources (drones, satellites, aircraft)
Global coverage with varying resolution
STAC-based querying (most recent imagery first)
Tile naming following mercantile standard: OAM-{x}-{y}-{z}.tif
Automatic georeferencing using rasterio
RGB imagery (3-band)
Bbox format
Dataset usage#
Provide a bounding box and zoom level to download tiles:
dataset = OpenAerialMap( paths='data/openaerial', bbox=(lon_min, lat_min, lon_max, lat_max), zoom=19, download=True, )
If you use this dataset in your research, please cite OpenAerialMap:
Added in version 0.10.
- filename_glob = 'OAM-*.tif'#
Glob expression used to search for files.
This expression should be specific enough that it will not pick up files from other datasets. It should not include a file extension, as the dataset may be in a different file format than what it was originally downloaded as.
- __init__(paths='data', crs=None, res=None, bbox=None, zoom=19, max_items=1, transforms=None, cache=True, download=False, image_id=None, tile_size=256)[source]#
Initialize a new OpenAerialMap dataset instance.
- Parameters:
paths (str | PathLike[str] | Iterable[str | PathLike[str]]) – one or more root directories to search or files to load
crs (CRS | None) – coordinate reference system (CRS) to warp to (defaults to EPSG:4326)
res (float | tuple[float, float] | None) – resolution of the dataset in units of CRS (defaults to resolution of first file found)
bbox (tuple[float, float, float, float] | None) – bounding box for STAC query as (xmin, ymin, xmax, ymax) in EPSG:4326.
zoom (int) – zoom level for tiles (15-23), only used when download=True. Higher zoom = more detail. Typical values: 18-20 for high-res drone imagery. Higher zoom gives higher resolution but covers less area per tile. Consider increasing tile_size for better quality at the same zoom. Check the GSD of the image before downloading.
max_items (int) – maximum number of STAC items to query.
transforms (Callable[[dict[str, Any]], dict[str, Any]] | None) – a function/transform that takes an input sample and returns a transformed version.
cache (bool) – if True, cache file handle to speed up repeated sampling
download (bool) – if True, download imagery from STAC API based on bbox
image_id (str | None) – optional STAC item ID to download specific imagery
tile_size (Literal[256, 512, 768, 1024]) – size of the tiles to download (supported : 256 , 512, 768, 1024); Do verify they exists in the remote image source as resolution of each image varies.
- Raises:
DatasetNotFoundError – If dataset is not found and download=False.
ValueError – If download=True but neither bbox nor image_id is provided.