pyufunc.get_osm_by_bbox#
- pyufunc.get_osm_by_bbox(bbox, output_filepath='map.osm', url='www.overpass-api.de/api/interpreter')#
Downloads OpenStreetMap (OSM) data for a specified bounding box using the Overpass API.
This function queries the Overpass API for a given bounding box, retrieves the corresponding map data, and saves it to a local file.
- Parameters:
bbox (tuple) – A tuple containing the bounding box coordinates in the format (min_latitude, min_longitude, max_latitude, max_longitude).
output_filepath (str) – The path where the downloaded OSM data will be saved. Defaults to ‘map.osm’.
url (str) – The URL of the Overpass API endpoint. Defaults to ‘www.overpass-api.de/api/interpreter’.
Example
>>> import pyufunc as pf >>> bbox = (-122.4194, 37.7749, -122.3894, 37.8049) # Example bounding box: >>> pf.get_osm_by_bbox(bbox, output_filepath='my_map.osm')
- Returns:
- True if the data was successfully downloaded and saved, False otherwise.
Returns None if the operation fails.
- Return type:
bool | None