Hello, if i want to lets say get all streets of specific city, is that possible with this API, or can i download data?
Hello to the OpenStreetMap Community. First of all: Yes, but not directly via a single OSM API call. The main OSM API is not designed for large data extraction like “all streets of a city”.
Instead, you can use:
- Overpass API to query all highways within a specific city boundary
- or download regional extracts (e.g. from Geofabrik) and filter the data locally
- alternatively use tools like osmium or osmfilter on a downloaded .pbf file
For example, with Overpass you can query all highway=* ways within an administrative boundary of the city.
I’d actually use OSMnx for this, as it’s geared to “download, model, analyze, and visualize street networks […] from OpenStreetMap.”
The OSMnx examples run in Google Collab without installing anything and easily produce output like shown in the image below in about a minute (Guess the city?).
Or other really pretty visualizations like Square-Mile Street Network Visualization | Geoff Boeing
See Downloading data - OpenStreetMap Wiki for broader overview.
Tnx for your answer, i am gonna parse data locally with c++ osmium lib
Is main data structure used for it ,graph?
