This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to get all nodes which belong to a way?

0
1

Hi there,

Im working on an Android App and trying to highlight a complete street. Right now Im doing this by the coordinates which are given to me by making a HTTP Request to nominatim. But unfortunately it doesnt give me the whole street, but only a small part of it.

So my question is: How can I achieve it, that I get all the coordinates which are shown to me when I search like this: https://www.openstreetmap.org/way/3957228

Thanks for your help! cheers Jan

asked 04 Dec '16, 21:38

janPhil's gravatar image

janPhil
10112
accept rate: 0%

1

Where are you fetching your data from? (Note that the API provided at openstreetmap.org is only really for the use of editing software.)

(05 Dec '16, 13:46) Richard ♦

2 Answers:

2

Downloading from https://www.openstreetmap.org/api/0.6/way/3957228/full will return the way including all of its nodes. Read the API documentation for more information.

Please keep in mind that his API is mainly for editing the map as already explained by Richard. Read the API usage policy.

answered 05 Dec '16, 15:13

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

Hey Scai,

thanks for your answer! The App is just for my Master thesis and so its only a showcase. I will only make a few requests per day, not many.

Thanks again!

Jan

(06 Dec '16, 09:50) janPhil

2

As @scai suggested you can use overpass api

Get Method as JSON output:

http://overpass-api.de/api/interpreter?data=[out:json];way(24777894);(._;>;);out;

Post Method with curl as XML output:

curl \
  -H "Host: overpass-api.de" -H "Content-Type: text/xml"  \
  -d 'data=[out:xml];way(3957228);(._;>;);out;'  \
  http://overpass-api.de/api/interpreter  \
  -o my-way.osm

answered 06 Dec '16, 11:25

Gagan's gravatar image

Gagan
3053515
accept rate: 14%

Source code available on GitHub .