pyufunc.get_osm_by_relation_id#

pyufunc.get_osm_by_relation_id(relation_id, output_filepath='map.osm', url='www.overpass-api.de/api/interpreter')#

Downloads OpenStreetMap (OSM) data for a specified region using the Overpass API.

This function queries the Overpass API for a given OSM relation ID, retrieves the corresponding map data, and saves it to a local file.

Parameters:
  • relation_id (int) – The OSM relation ID for the area to be queried.

  • 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’.

See also

SUMO Documentation: eclipse-sumo/sumo osm2gmns Documentation: jiawlu/OSM2GMNS

Example

>>> import pyufunc as pf
>>> relation_id = 123456789  # Example relation ID (Get this from OSM)
>>> pf.get_osm_by_relation_id(relation_id, output_filepath='my_map.osm')
Returns:

True if the data was successfully downloaded and saved, False otherwise.

Returns None if the data could not be downloaded.

Return type:

bool | None