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

1
1

Hi everyone,

how can i get the relation id by the node id?

Or in other words - how can i get from here: http://www.openstreetmap.org/api/0.6/node/240076989 to here: http://www.openstreetmap.org/api/0.6/relation/191645 (which both is the city of dresden)

Thank you for every contribution.

asked 29 Nov '17, 12:53

T4Titan's gravatar image

T4Titan
26113
accept rate: 0%


Just append /relations to your first link: http://www.openstreetmap.org/api/0.6/node/240076989/relations

This will return all relations the node is part of. This feature is described here.

permanent link

answered 29 Nov '17, 12:56

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

Greetings to dresden :)

(29 Nov '17, 13:44) T4Titan

Thank you for your fast answer. I have not expected such an easy way :D Which osm tool do i have to use to query big amounts of data?

Maybe the overpass api is able to handle such volumes. https://overpass-api.de/api/interpreter?data=[out:json];out; But i have no idea how to do this query from above whit this api.

Is there anyone who is able to formulate the correct query?

...a query that uses the node id of a city/village to get its direct parent relations id (which is the city also)

https://overpass.kumi.systems/api/interpreter?data=[out:json];node( IdOfNode );<; filteringToGetTheParentRelationWhichDesribesAlsoTheCityOrVillage out;

I need this id to be able to use nominatim to get the borders of all cities in my database.

permanent link

answered 29 Nov '17, 13:30

T4Titan's gravatar image

T4Titan
26113
accept rate: 0%

edited 30 Nov '17, 09:32

1

Which query? The main API is just an editing API and should not be used to perform large queries. Overpass API instead can handle rather large queries.

(29 Nov '17, 13:46) scai ♦
1

...a query that uses the node id of a city/village to get its direct parent relations id (which is the city also)

https://overpass.kumi.systems/api/interpreter?data=[out:json];node( IdOfNode );<; filteringToGetTheParentRelationIdOfTheRelationWhichDesribesAlsoTheCityOrVillage out;

(30 Nov '17, 09:33) T4Titan

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:

×710
×290
×236
×205
×55

question asked: 29 Nov '17, 12:53

question was seen: 6,792 times

last updated: 30 Nov '17, 09:34

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