NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the 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

razor85
6113
accept rate: 0%

edited 21 Jan '11, 09:25

TomH's gravatar image

TomH ♦♦
3.3k83943


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 ♦
82.5k927201273
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

petschge
8.3k217398
accept rate: 21%

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

question asked: 22 Dec '10, 18:24

question was seen: 8,413 times

last updated: 21 Jan '11, 09:25

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