An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
How to get streets data using overpass Api
I will show you a simple and fastly way to get the streets geometry and another information from OSM(open streeet maps), to do this, we will use Overpass turbo.
According the wiki of open street maps, Overpass turbo is is a web based data mining tool for OpenStreetMap that run runs any kind of Overpass API query and shows the results on an interactive map.
- Go to https://overpass-turbo.eu/.
- Select in Wizard
- Write
highway=* and type:way
- Click on build and run query
Overpass turbo will create automatically the following query
[out:json][timeout:25];( way["highway"]({{bbox}}););out body;>;out skel qt;
And now you can run it and see all the streets geometries drawn on the map.
Now, you can click on Export and click on GeoJSON download button.
Also, you can use the Query Wizard
to find another type of places, the following query have been generated writing only the word "shop", and it returns the shops places.
[out:json][timeout:25];( node["shop"]({{bbox}}); way["shop"]({{bbox}}); relation["shop"]({{bbox}}););out body;>;out skel qt;
In addition, if you don't want to get only the streets selected on the web IU, you can replace {{bbox}}
to your manually selected coordinates.
[out:json][timeout:25];( way["highway"]( 18.806908708848084, -98.95872831344604, 18.825777549841018, -98.94263505935669 ););out body;>;out skel qt;
In case you need to obtain many more geometries, I recommend you to use a tool like osm2po.
For know more about this topic, please check the documentation:
- https://wiki.openstreetmap.org/wiki/Main_Page
- https://wiki.openstreetmap.org/wiki/API
- https://wiki.openstreetmap.org/wiki/Overpass_API
- https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL
I will be writing soon, how to import this data into postgres.
Original Link: https://dev.to/toodaniels/how-to-get-streets-data-using-overpass-api-2b2g
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To