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

2
1

Hi, I am new to OSM and trying to understand Overpass QL so editing of public Transport data in JOSM will be easier in the future.

My Question is, why this Overpass QL query won't give me any data, not even the data I just added myself?

[out:json];
(
  relation["type"="route_master"]["route_master"="bus"](51.3649215, 9.2642212, 51.7134161, 9.810791);
);
rel(r);
way(r);
out meta qt;

As far as I think, this query works this way:

  1. I ask for json-data (but xml won't work, either)
  2. I like to get all relations in the bounding box which carry the tags type=route_master and route_master=bus
  3. from that I recursively ask for all child-relations
  4. and from that for child ways
  5. (and even if I ask for child nodes, I won't get any data)
  6. and then I print the result (with all data there is, geographically ordered (whatever this means) )

So whats wrong with that query (or the data I added previously). Could anybody explain it to me?

P.S.: I just had to type this once again, because the wait for email-validation (after creating a new account) didn't seem to keep this question pending, but instead deleted it. P.P.S.: It is denglish I am writing. If there is a native english speaker here who cares for educating his or hers language: I am listening.

asked 09 Jul '16, 11:14

jannefleischer's gravatar image

jannefleischer
46114
accept rate: 0%


Tricky question ... :)

Master relations don't have any geometry on their own. That's why your query won't find anything for a given bounding box in step 2 already. I'm not sure if that's a bug or not, at least it doesn't work right now (Github issue opened).

I have changed that part of your query to include the network "NVV" and effectively turned it into a global scale query for route_master relations. That's purely a performance tweak to reduce the number of relevant master relations from 21862 down to 64.

Now, instead of applying the bounding box filter to the master relation, I'm using the individual bus routes via (rel(r){{bbox}}) for that purpose. As those bus routes all have their proper geometry information, using the bounding box as a filter shouldn't be an issue anymore.

overpass turbo link

[out:json];
relation["type"="route_master"]["route_master"="bus"][network="NVV"];
(rel(r)({{bbox}});>;);
out meta;
permanent link

answered 09 Jul '16, 11:39

mmd's gravatar image

mmd
5.7k15388
accept rate: 37%

edited 09 Jul '16, 12:26

2

Thanks for your immediate response. I had my problems with the first revision of your answer, but now I think I understood. The problem is, that, since the relation master_route do not contain any geometries, I can't filter it with a bounding box. So I first have to get the sub-routes (tag: route) and use the bounding-box filter over those.

Thanks for pointing this out to me. It wasn't that trivial as I expected it to be, after all. :)

The wizard provides a template called (in german) „Hauptroute" which does it wrong, too. Reported it: https://github.com/tyrasd/overpass-turbo/issues/254

(09 Jul '16, 12:28) jannefleischer

Just a note: this answer helped me create a query to render a relation and it's subrelations (queried by master relation ID): http://overpass-turbo.eu/s/hTR

(17 Aug '16, 10:20) joost schouppe

@joost schouppe: (relation(2099432);>>;);out body; would be the usual approach, as you already have a relation id.

(17 Aug '16, 11:53) mmd

I noticed it does make a small difference: it also returns the tagged nodes that are members of the ways of the relations, whereas the other approach just returns member relations.

(17 Aug '16, 12:00) joost schouppe

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:

×236
×179
×84
×65
×4

question asked: 09 Jul '16, 11:14

question was seen: 5,387 times

last updated: 17 Aug '16, 12:00

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