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

Hi, I have an 'way id' of my route. I want to extract all nodes which belongs to this specific route. I can make a query e.g.: http://api.openstreetmap.org/api/0.6/way/xxxyyzz In response I receive series of node reference id's. Then I need to make recursive lookup to search each single point to get GPS data. Do you know automatic tool to extract such data? I will provide way_id and in response get series of GPS coordinates. It is fair easy to write such tool but maybe you know readily available software.

asked 22 Dec '10, 18:24

razor85's gravatar image

accept rate: 0%

edited 21 Jan '11, 09:25

TomH's gravatar image

TomH ♦♦

There is an API request that returns the way and all its nodes:

permanent link

answered 22 Dec '10, 18:38

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

You can download http://api.openstreetmap.org/api/0.6/way/xxxyyzz/full instead of http://api.openstreetmap.org/api/0.6/way/xxxyyzz/. This will contain all the nodes that are in this way, thus avoiding the need for further queries.

You can use something like

wget -q -O - http://api.openstreetmap.org/api/0.6/way/xxxyyzz/full | sed -ne 's/<node.*lat="\(.*\)" lon="\(.*\)" version.*/\1 \2/p'

to limit output to the latitude and longitude of the node. (And yes I know that parsing XML with regex is evil.)

permanent link

answered 22 Dec '10, 18:41

petschge's gravatar image

accept rate: 21%

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: 22 Dec '10, 18:24

question was seen: 7,809 times

last updated: 21 Jan '11, 09:25

powered by OSQA