Search code examples
openstreetmapoverpass-api

overpass-api ways query include coordinates


I'm trying to query Hotels in a specific area. Unfortunately I need to query nodes and ways, because some Hotels are only stored as way and some as nodes.

http://overpass.osm.rambler.ru/cgi/interpreter?data=%28way[tourism~hotel]%28around:5000,50.10707,8.76040%29%29;out;

The result of a way-query doesn't contain any coordinates, only lots of node-refs:

<nd ref="1438833423"/>

Is there a way also to include the coordinates of the nodes in the output or do have to start lots of additional queries for each node?

Tom


Solution

  • Yes, there are several ways to also get geometries for non-node features via the Overpass API. The easiest is probably to use the center output mode (replace out; with out center;): http://overpass-turbo.eu/s/4O4. Other options would be to fetch the node references in a recursion step: http://overpass-turbo.eu/s/4O5 or using the full geometry output mode.

    PS: Don't forget that a hotel can also be mapped as a (multipolygon) relation in OSM, not just as a node or way.