DEV Community

Cover image for How to get streets data using overpass Api
Daniel Torres
Daniel Torres

Posted on • Edited on

10 1

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;


Enter fullscreen mode Exit fullscreen mode

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;


Enter fullscreen mode Exit fullscreen mode

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;


Enter fullscreen mode Exit fullscreen mode

Now, you can use another tool to show this information such as:

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:

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay