Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 31, 2022 03:42 am GMT

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.

  1. Go to https://overpass-turbo.eu/.
  2. Select in Wizard
  3. Write highway=* and type:way
  4. 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.

Cuautla streets on overpass turbo

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:

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

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To