GoogleAerialImageExtractor#
- class rapidtools.data_sources.GoogleAerialImageExtractor(save_directory: str | Path = 'output', zoom_level: int = 20, max_workers: int = 10, layer: str = 's', **kwargs: Any)[source]#
Bases:
WebMercatorTileExtractorClient for extracting satellite imagery from Google Maps tiles.
- Parameters:
save_directory – Directory where stitched images will be saved.
zoom_level – Map detail level (1-21). Defaults to 20 (~0.15 m/px).
max_workers – Number of concurrent download threads.
layer –
's'for satellite imagery (default) or'y'for the hybrid layer with road labels.
Example
>>> from rapidtools.data_sources import GoogleAerialImageExtractor >>> with GoogleAerialImageExtractor('out', zoom_level=20) as extractor: ... for tile, bbox, (x, y, z) in extractor.generate_polygon_tiles(feature): ... print(x, y, z, tile.size)
Methods
buffered_boundsExpand a polygon's bounds by a percentage of its width and height.
generate_polygon_tilesYield individual tiles intersecting a GeoJSON polygon feature.
generate_region_tilesYield individual tiles covering a bounding box.
lat_lon_to_pixelConvert latitude and longitude to global Web Mercator pixel coordinates.
pad_to_squareCenter an image on a black square canvas whose side is its longer edge.
pixel_to_lat_lonConvert global Web Mercator pixel coordinates back to latitude/longitude.
process_geojsonRead a GeoJSON file and save one image per polygon feature.
process_polygonDownload, stitch, crop and save imagery for one GeoJSON polygon feature.
stitch_regionDownload every tile covering a bounding box and crop the mosaic to it.
tile_boundsReturn the geographic bounds of an XYZ tile.