Why not ask your question on the new OpenStreetMap Community Forum?


I am using the Overpass API / Overpass Turbo to get a single relation (like http://overpass-turbo.eu/s/zog). Here I get the the relation including its members which are some nodes (these are the train stops), ways and some other relations:

{"elements": [
   { "type": "relation",
     "id": 7796142,
     "members": [
      { "type": "node",
        "ref": 2813070487,
        "role": "stop"
      { "type": "way",
        "ref": 202719939,
        "role": "platform"
      { "type": "node",
        "ref": 604676237,
        "role": "stop"
      }, ... ],

For a java program I would like to first take the information from one of the ways. Then, in an other API request, ask for the information of its node members. But how can I find the members of a way by only having the information about its "type", "ref", and "role"? I guess I need something like the ID.

I could use the "recursive down" function ">;" to get the nodes but doing so, I loose information about the sorting in which the nodes appear inside the way. In total I want to keep track of the sorting of the whole relation to create a elevation model (that is depending on the geographic coordinates of each node) later on.

My current Overpass query is sorting the nodes and ways by its "role" tag, but how to sort these is another question.

asked 07 Jun '18, 07:30

Tigerclaw1993's gravatar image

accept rate: 0%

edited 07 Jun '18, 11:51

maxerickson's gravatar image


The values given for ref are ids.

Each way gives the order of the nodes, so you should be able to use > to get what you want, you'd just need to retrieve the objects of interest from the data returned. The objects aren't in the order you want, but the information necessary to construct the order is returned.

The options for sorting the Overpass-API results are limited, either by id or using a geographic index. But trying to get results from Overpass-API in a significant order is probably an anti-pattern, better to just retrieve all the necessary data and do the ordering on the client.

permanent link

answered 07 Jun '18, 12:09

maxerickson's gravatar image

accept rate: 32%

Thanks a lot :)

(07 Jun '18, 14:32) Tigerclaw1993
Your answer
toggle preview

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](http://url.com/ "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: 07 Jun '18, 07:30

question was seen: 1,617 times

last updated: 07 Jun '18, 14:32

powered by OSQA