0

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

razor85
6113
accept rate: 0%

edited 21 Jan '11, 09:25

TomH's gravatar image

TomH ♦♦
3.2k83541


2 Answers:
4

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

http://api.openstreetmap.org/api/0.6/way/xxxyyzz/full
permanent link

answered 22 Dec '10, 18:38

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
73.3k866641137
accept rate: 24%

1

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

petschge
8.0k207197
accept rate: 21%

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:

×248

question asked: 22 Dec '10, 18:24

question was seen: 6,346 times

last updated: 21 Jan '11, 09:25

powered by OSQA