Why not ask your question on the new OpenStreetMap Community Forum?

<query type="way">
<has-kv k="int_ref" v="E 40"/>
<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 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 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"/>

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

accept rate: 0%

edited 02 Mar '15, 14:11


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 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"/>

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=village]; );

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
accept rate: 35%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



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:


question asked: 02 Mar '15, 13:43

question was seen: 2,533 times

last updated: 03 Mar '15, 07:26

powered by OSQA