This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Export A Single Road

0

Is it possible to export a single road? If so, how? I am able to successfully export all roads for a given area, but I would rather do 1 road at a time. Please let me know and thank you in advance!

asked 28 Jul '16, 21:43

TonesJones's gravatar image

TonesJones
11112
accept rate: 0%

2

Do you have a specific reason for downloading roads one by one? Usually it more efficient to fetch multiple roads in one go, rather than downloading them one by one (assuming you want to download all roads in an area anyway and your area is not too large).

(30 Jul '16, 18:47) mmd
1

You can also download multiple objects in one go using their id rather than using a bounding box.

(02 Aug '16, 10:11) Vincent de P... ♦

One Answer:

2

You can fetch elements by id using Overpass API:

https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_element_id

The simplest script to retrieve a way would be something like this:

way(17500233);
out geom;

Here's that query in Overpass Turbo, an IDE for Overpass API:

http://overpass-turbo.eu/s/hyA

You can use it to experiment and see if Overpass is suitable for your needs. Once you have your query worked out, you can fetch the ways directly from Overpass API.

answered 28 Jul '16, 22:09

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

(29 Jul '16, 07:55) scai ♦
2

Remember that one "road" in everyday speech can be made of multiple "ways" in OSM data. Overpass could help downloading all ways of one "road" but you'll have to tweak the query on a case by case basis.

(02 Aug '16, 10:07) Vincent de P... ♦

Source code available on GitHub .