environmentaltools.download.download_google_maps_image
- environmentaltools.download.download_google_maps_image(lat: float, lng: float, zoom: int = 13, layer: str = 's', tile_width: int = 5, tile_height: int = 5, output_file: str = 'google_maps_image.png') bool[source]
Download and save a Google Maps image for specified coordinates.
Convenience function that creates a GoogleMapDownloader, generates an image, and saves it to disk.
- Parameters:
lat (float) – Latitude of center location in decimal degrees.
lng (float) – Longitude of center location in decimal degrees.
zoom (int, optional) – Zoom level (0-23). Defaults to 13.
layer (str, optional) – Map layer type. Defaults to GoogleMapsLayers.SATELLITE.
tile_width (int, optional) – Number of tiles wide. Defaults to 5.
tile_height (int, optional) – Number of tiles high. Defaults to 5.
output_file (str, optional) – Output filename. Defaults to “google_maps_image.png”.
- Returns:
True if successful, False otherwise.
- Return type:
bool
Example
>>> # Download satellite image of New York City >>> success = download_google_maps_image( ... lat=40.7128, ... lng=-74.0060, ... zoom=15, ... layer=GoogleMapsLayers.SATELLITE, ... tile_width=3, ... tile_height=3, ... output_file="nyc_satellite.png" ... ) >>> if success: ... print("Map downloaded successfully")