environmentaltools.download.download_openstreet_map
- environmentaltools.download.download_openstreet_map(lon: float, lat: float, distance_x: float, distance_y: float, site_name: str, style: Literal['map', 'satellite'] = 'satellite', output_file: str | None = None, show_plot: bool = True) None[source]
Download and display OpenStreetMap image for a specified location.
This is a convenience wrapper function for creating OpenStreetMap visualizations with either satellite imagery or street map style.
- Parameters:
lon – Longitude of the center point in degrees.
lat – Latitude of the center point in degrees.
distance_x – Distance from center to edge in the x-direction (meters).
distance_y – Distance from center to edge in the y-direction (meters).
site_name – Name of the site/location for the plot title.
style – Map style, either ‘map’ for street map or ‘satellite’ for satellite imagery. Default is ‘satellite’.
output_file – Path to save the image file. If None, image is not saved. Supported formats: .png, .jpg, .jpeg, .pdf, .svg, .eps
show_plot – Whether to display the plot interactively. Default is True.
- Returns:
None. Displays and/or saves the map.
Example
>>> # Display and save satellite image >>> download_openstreet_map( ... lon=-3.7038, ... lat=40.4168, ... distance_x=500, ... distance_y=500, ... site_name="Madrid", ... style="satellite", ... output_file="madrid_satellite.png", ... show_plot=True ... ) >>> >>> # Save only (no display) >>> download_openstreet_map( ... lon=-3.7038, ... lat=40.4168, ... distance_x=500, ... distance_y=500, ... site_name="Madrid", ... style="map", ... output_file="madrid_map.png", ... show_plot=False ... )