Image downloaders¶
These classes download image files into a data store. They are not handlers and not fetchers.
from gigaspatial import MaxarImageDownloader, MapboxImageDownloader
from gigaspatial.image_downloaders import MaxarConfig
download_images_by_coordinates(data, res_meters_pixel, output_dir, image_size=(512, 512), image_prefix='maxar_image_', save_metadata=False, start_date=None, end_date=None) ¶
Download images for given coordinates by creating bounding boxes around points
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
res_meters_pixel | float | Resolution in meters per pixel | required |
output_dir | Union[str, Path] | Directory to save images | required |
image_size | Tuple[int, int] | Tuple of (width, height) for output images | (512, 512) |
image_prefix | str | Prefix for output image names | 'maxar_image_' |
save_metadata | bool | If True, saves WFS metadata as JSON alongside each image | False |
start_date | Optional[Union[str, datetime, date]] | Filter images acquired on or after this date (YYYY-MM-DD) | None |
end_date | Optional[Union[str, datetime, date]] | Filter images acquired on or before this date (YYYY-MM-DD) | None |
download_images_by_bounds(gdf, output_dir, image_size=(512, 512), image_prefix='maxar_image_', save_metadata=False, start_date=None, end_date=None) ¶
Download images for given bounding box polygons
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gdf | GeoDataFrame | GeoDataFrame containing bounding box polygons | required |
output_dir | Union[str, Path] | Directory to save images | required |
image_size | Tuple[int, int] | Tuple of (width, height) for output images | (512, 512) |
image_prefix | str | Prefix for output image names | 'maxar_image_' |
save_metadata | bool | If True, saves WFS metadata as JSON alongside each image | False |
start_date | Optional[Union[str, datetime, date]] | Filter images acquired on or after this date (YYYY-MM-DD) | None |
end_date | Optional[Union[str, datetime, date]] | Filter images acquired on or before this date (YYYY-MM-DD) | None |
download_images_by_tiles(mercator_tiles, output_dir, image_size=(512, 512), image_prefix='maxar_image_', save_metadata=False, start_date=None, end_date=None) ¶
Download images for given mercator tiles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mercator_tiles | MercatorTiles | MercatorTiles instance containing quadkeys | required |
output_dir | Union[str, Path] | Directory to save images | required |
image_size | Tuple[int, int] | Tuple of (width, height) for output images | (512, 512) |
image_prefix | str | Prefix for output image names | 'maxar_image_' |
save_metadata | bool | If True, saves WFS metadata as JSON alongside each image | False |
start_date | Optional[Union[str, datetime, date]] | Filter images acquired on or after this date (YYYY-MM-DD) | None |
end_date | Optional[Union[str, datetime, date]] | Filter images acquired on or before this date (YYYY-MM-DD) | None |
Examples:
Download only recent imagery¶
downloader.download_images_by_tiles( mercator_tiles=tiles, output_dir="output/", start_date="2024-01-01" )
Download imagery from specific date range¶
downloader.download_images_by_tiles( mercator_tiles=tiles, output_dir="output/", start_date="2023-06-01", end_date="2023-12-31" )
Class to download images from Mapbox Static Images API using a specific style
download_images_by_coordinates(data, res_meters_pixel, output_dir, image_size=(512, 512), max_workers=4, image_prefix='image_') ¶
Download images for given coordinates by creating bounded boxes around points
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | Union[DataFrame, List[Tuple[float, float]]] | Either a DataFrame with either latitude/longitude columns or a geometry column or a list of (lat, lon) tuples | required |
res_meters_pixel | float | Size of the bounding box in meters (creates a square) | required |
output_dir | Union[str, Path] | Directory to save images | required |
image_size | Tuple[int, int] | Tuple of (width, height) for output images | (512, 512) |
max_workers | int | Maximum number of concurrent downloads | 4 |
image_prefix | str | Prefix for output image names | 'image_' |
download_images_by_bounds(gdf, output_dir, image_size=(512, 512), max_workers=4, image_prefix='image_') ¶
Download images for given points using the specified style
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gdf_points | GeoDataFrame containing bounding box polygons | required | |
output_dir | Union[str, Path] | Directory to save images | required |
image_size | Tuple[int, int] | Tuple of (width, height) for output images | (512, 512) |
max_workers | int | Maximum number of concurrent downloads | 4 |
image_prefix | str | Prefix for output image names | 'image_' |
download_images_by_tiles(mercator_tiles, output_dir, image_size=(512, 512), max_workers=4, image_prefix='image_') ¶
Download images for given mercator tiles using the specified style
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mercator_tiles | MercatorTiles | MercatorTiles instance containing quadkeys | required |
output_dir | Union[str, Path] | Directory to save images | required |
image_size | Tuple[int, int] | Tuple of (width, height) for output images | (512, 512) |
max_workers | int | Maximum number of concurrent downloads | 4 |
image_prefix | str | Prefix for output image names | 'image_' |