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

3
1

Speaking in Overpass QL I can select a node by its ID:

node(3815147164);out;

This however doesn't provide any info about relations or ways this node is a part of.

Going to OSM site: http://www.openstreetmap.org/node/3815147164 I can see at least which ways the node belongs to. And then to the way page: http://www.openstreetmap.org/way/136322077 I see its relations.

In Overpass relations are not returned, even for the way query:

way(136322077);out;

Any ideas how to get relations?

asked 29 Jan '16, 07:44

ivanatora's gravatar image

ivanatora
2.7k355568
accept rate: 7%

edited 29 Jan '16, 10:17


Overpass API only returns objects that are explicitly included in the query. To fetch the parents of an input set, use recurse up:

(node(3815147164);
<;
);
out geom;

Note that < does not fetch the parents of relations, use << for that.

There are also some more fine grained operators if you only want the parent ways of nodes or whatever:

http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Recurse_.28n.2C_w.2C_r.2C_bn.2C_bw.2C_br.29

permanent link

answered 29 Jan '16, 14:59

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Node 3815147164 is not part of any relation itself. It is part of way 136322077 which in turn is part of a relation. You already seem to have figured this out by yourself but your question is still a little bit misleading.

You don't need Overpass API for returning the ways a node is part of, see http://www.openstreetmap.org/api/0.6/node/3815147164/ways. And you don't need Overpass API for returning the relation a node or way is part of, see http://www.openstreetmap.org/api/0.6/way/136322077/relations.

If this doesn't really answer your question then maybe someone can come up with an Overpass API query for returning the relation(s) containing way(s) a node is part of.

permanent link

answered 29 Jan '16, 09:22

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

edited 29 Jan '16, 09:23

Yeah, you are right. I've changed the title a bit, to match my intention in a better way.

I'd like to have a pure Overpass solution and not having to mix different APIs in the same application.

(29 Jan '16, 10:19) ivanatora

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:

×483
×236

question asked: 29 Jan '16, 07:44

question was seen: 11,711 times

last updated: 29 Jan '16, 14:59

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