1

I try to obtain all ways/nodes/relations with a special tag from OpenStreetMap. I use the following code to receive all hotels (in a small town in Austria):

//[out:csv(name, "addr:street", "addr:city")][timeout:25];
area
  [boundary=administrative]
  ["name"="Fügen"];
out body;
// gather results
(
  // query part for: “building=* and name=*”
  node["tourism"="hotel"](area);
  way["building"]["tourism"="hotel"](area);
  relation["building"]["tourism"="hotel"](area);
);
// print results
out body;

You may access the result via Overpass. However, this result gives me only the nodes. Ways like #89729697 also having the tourism = hotel tag are not returned.

How do I also query for the ways and relations having the tag I am looking for?

3

That's a quite common mistake. Please refer to this post for a more comprehensive explanation.

You need to store the area in a dedicated input set (here: myarea), otherwise the first statement inside the union statement will overwrite your area Fügen and the way/relation statement no longer have an area to work on.

Here's how your query should look like: http://overpass-turbo.eu/s/dix

area
  [boundary=administrative]
  ["name"="Fügen"]->.myarea;

(
  node["tourism"="hotel"](area.myarea);
  way["building"]["tourism"="hotel"](area.myarea);
  relation["building"]["tourism"="hotel"](area.myarea);
);

out geom;
  • thank you very much for your fast answer! I was thinking on this issue quite a long time ;) – Seb Dec 16 '15 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.