NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum


i have a segment (of a motorway, for example).

is it possible to get all other segments of said motorway using OSM?

asked 13 Nov '13, 18:38

tonygil's gravatar image

accept rate: 0%


Please be more specific about what should be in the result:

Should the reverse direction of a dual carriageway be included?

Should everything with the same road number be included or the entire motorway grid? What about motorways that are split in multiple non-connected parts?

What parts of exit lanes, intersections and so on should be included?

(14 Nov '13, 07:14) Roland Olbricht

thanx roland, wow, you got me there. in an ideal situation, everything that is related as part of the SAME motorway (numbering or name).

(14 Nov '13, 09:37) tonygil

It is technically possible from the OSM API (making recursive use of the /node/123/ways call to find out which other ways use the first/last node of the given way), but if done frequently it would be considered an abuse of the API.

Often, the motorway will be part of a relation, and then it would be possible to use the /relation/123/full call to download the full relation. This, too, is something that we don't like to see in an automated fashion.

If you want to make such queries regularly, set up your own database and import OSM data into it. Alternatively, check out if Overpasss API offers something that you can use.

permanent link

answered 13 Nov '13, 21:28

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%


An algorithm that adds all connected ways is likely to grab the entire street grid (at least of an island, maybe also Eurasia or America).

A similar thing happens when one restricts to motorway and motorway_link with the motorway network.

Thus I would strongly discourage this approach.

(14 Nov '13, 07:10) Roland Olbricht

yes, i understand that, to do so, i would have to be using my own copy of OSM database, so as not to abuse the API. what approach would you suggest?

(14 Nov '13, 09:39) tonygil

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 13 Nov '13, 18:38

question was seen: 6,412 times

last updated: 14 Nov '13, 09:39

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum