In the previous example, we found all hotels within a certain distance of Taj Mahal, but what if we only want to know about the closest one? It’s possible to specify that by limiting the results to the closest object with the “Limit to” field.
Not every query can be answered by just looking for one specific tag. With some queries, we are looking for objects that have two specific tags at the same time. A typical example is a restaurant serving a specific cuisine, like in the following example. (Note that the two tags are just separated by a comma when both should apply.)
Chinese restaurants in Rome
Question Class | Thing in Area |
Target Tags | amenity=restaurant,cuisine=chinese |
Area | Rome |
QType | latlong |
With other queries, we are looking for objects that have either of two possible tags. This can be due to our query not caring about subtle differences or due to idiosyncrasies in the OpenStreetMap data. When you’re looking for an ATM to draw cash, you probably want to include dedicated ATMs as well as banks that happen to have an ATM. (Here, the tags are connected by an “or” operator.)
Closest ATM to Spanish Steps in Rome
Question Class | Thing around Reference Point |
Target Tags | or(amenity=atm,atm=yes) |
Reference Point | name=Spanish Steps |
Area | Rome |
Limit to | Closest |
QType | latlong |
In these multi-tag cases, it can be hard to know what tag combination you’re really looking for. That’s why there is dedicated help for the most common ones available. You can recognize it by its golden border. Please respect the tag combination that is given in these tips if you’re not 100% sure what you’re doing.
Name the synagogue that is closest to the Országház in Budapest!
✔ Completed.
query(around(center(area(keyval('name','Budapest')),nwr(keyval('name','Országház'))),search(nwr(keyval('amenity','place_of_worship'),keyval('religion','jewish'))),maxdist(DIST_INTOWN),topx(1)),qtype(findkey('name')))
❌ Not completed yet.
{% endif %}