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


I want to extract a route with the Overpass API which works great. But I have some problemns getting the order of the nodes inside the relation right.

Check this relation:

It looks good on the map. But when you look at the data tab and you scroll a little down you see the coordinates jump from

  • 13.8223610, 100.5474506
  • To
  • 15.1323097, 100.4504222

which is in the middle of the route. At the bottom there are the parts which are in between. (

So when I extract the route, process all the coordinates in the order the api returns them and convert it to a Google Polyline path, the route is messed up.

Paste this path into Google maps example ( and click decode polyline)


How do I get overpass to give the nodes inside the relation in the correct order??

asked 06 Jul '16, 16:00

NLAnaconda's gravatar image

accept rate: 0%

Your conversion routine does not seem to work correctly. Ways in relations don't need to follow the exact sequence of a route. As Overpass API delivers the data in the exact same sequence as they are in the main OSM database, it's your responsibility to bring them in the right sequence in a post-processing step.

As additional hint, please see this answer by scai: link

Furthermore, you might want to check the result of (relation(1820650);>;);out meta; to get all node ids as well. out geom; only provides lat/lon values of nodes, but omits all node ids.

permanent link

answered 06 Jul '16, 17:01

mmd's gravatar image

accept rate: 37%

edited 06 Jul '16, 17:08

(07 Jul '16, 02:09) NLAnaconda

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: 06 Jul '16, 16:00

question was seen: 4,084 times

last updated: 07 Jul '16, 02:09

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