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

Hi, I'm pretty new a OSM & the Overpass API.

I was looking for, how to retrieve a list a stations of a given relation.

Here is what came up with :

< id-query ref="2418275" type="relation" />
  < recurse type="relation-node" />  
< print/>

It works great but the station nodes are sorted by IDs in the XML. I was looking to get them sorted by the orientation (first station as first element, last station as last element).

Do you know how can I can achieve this ?

asked 02 Feb '14, 16:49

Kyro's gravatar image

Kyro
1216713
accept rate: 0%


Unfortunately, this is currently not possible with the Overpass API alone. What you can do is print the relation also and then sort the stations in a post-processing step.

permanent link

answered 02 Feb '14, 17:11

tyr_asd's gravatar image

tyr_asd
1.2k51927
accept rate: 64%

1

Ok thanks, I went with a bash script to do this :

for i in curl 'http://api.openstreetmap.org/api/0.6/relation/2418275' | grep stop | awk '{print $3}' | cut -d '"' -f2; do curl http://api.openstreetmap.org/api/0.6/node/${i} ; done`

(03 Feb '14, 01:02) Kyro
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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:

×483

question asked: 02 Feb '14, 16:49

question was seen: 1,988 times

last updated: 03 Feb '14, 01:03

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