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

I am trying to download a bus route. I want to obtain the elements that compose this relation of a tidy way, as they appear originally in the relation.

alt text

http://www.openstreetmap.org/api/0.6/relation/3723432

But when I download the route in the osm resulting file the ways are not ordered. This complicates the analysis that I want to realize in a Geographic Information System (I need to extract the nodes that the route form of a correlative way, from beginning to end).

http://www.openstreetmap.org/api/0.6/relation/3723432/full

Is there any mode to get the real order of the ways of a route? Also it serves me in the worst case some way to identify the position of each arc.

asked 08 May '14, 12:29

egofer's gravatar image

egofer
26112
accept rate: 0%


The file that you get when downloading the relation contains one relation element, several way elements, and several node elements. The relation element will contain references to the ways, in the right order - like

<member type="way" ref="123" />
<member type="way" ref="555" />

and so on. You will then have to extract the way elements from the file in this order, and the ways will in turn reference the nodes which again, you have to extract in the order given in the way.

This is something that will require just a few lines of code in a programming language of your choice. OSM itself doesn't provide a service that does this job for you. But you might want to check out the answers to "Export a way as GPX".

permanent link

answered 11 May '14, 12:26

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

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:

×290
×179
×167
×128
×17

question asked: 08 May '14, 12:29

question was seen: 5,363 times

last updated: 11 May '14, 12:26

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