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

<query type="way">
<has-kv k="int_ref" v="E 40"/>
</query>
<union>
<query type ="node">
<bbox-query s="49.7688" n="50.1479" e="22.8337" w="21.9143"/>
<around radius="4500"/>
<has-kv k="place" v="town"/>
</query>
<query type ="node">
<bbox-query s="49.7688" n="50.1479" e="22.8337" w="21.9143"/>
<around radius="4500"/>
<has-kv k="place" v="city"/>
</query>
<query type ="node">
<bbox-query s="49.7688" n="50.1479" e="22.8337" w="21.9143"/>
<around radius="4500"/>
<has-kv k="place" v="village"/>
</query>
</union>
<print/>

The following query should return all the nodes with k value town, village or city withing the given bound box and no more further than 4500 from way referenced E 40. However in xml result there is no "city" values. When I cut out <union> with "town" and "village" query and search only for those with key value "city" then the result is ok . I wonder what is the reason. Regards

asked 02 Mar '15, 13:43

huberttt's gravatar image

huberttt
31224
accept rate: 0%

edited 02 Mar '15, 14:11

1

This is really odd. When I ran it as you have written above, I only received town results. If I eliminate town I receive some but not all city and village results.

<query type="way">
<has-kv k="int_ref" v="E 40"/>
</query>
<query type="node">
<bbox-query s="49.7688" n="50.1479" e="22.8337" w="21.9143"/>
<around radius="4500"/>
<has-kv k="place" regv="city|village|town"/>
</query>
<print/>

gives you a more inclusive set of results, but I am not sure if it is right or not.

(03 Mar '15, 00:23) baghaii

Yes, I have already managed to write same code myself. Thank you for your response anyway. I still just don't know where is the problem in my previous query

(03 Mar '15, 07:26) huberttt

The "around" block in each query is relative to the preceding statement. The query block for "town" looks around the "E40". The next query block looks around the results of the "town" query block and so on. One solution would be to use a variable instead, i.e.:

way[int_ref="E 40"]->.e40;
( node(49.768,21.914,50.148,22.834)(around.e40:4500)[place=town];
  node(49.768,21.914,50.148,22.834)(around.e40:4500)[place=city];
  node(49.768,21.914,50.148,22.834)(around.e40:4500)[place=village]; );
out;

This is the query you probably intended.

The other, and probably more efficient solution is the one from the comment of baghaii.

permanent link

answered 03 Mar '15, 07:14

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

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
×147
×4

question asked: 02 Mar '15, 13:43

question was seen: 2,857 times

last updated: 03 Mar '15, 07:26

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