This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Overpass Query

0
1

I need to perform a query that collects all the nodes and ways that contain a specific tag. I also need, however, to get all the member nodes of the resulting ways even if they do not contain the specified tag. Finally, I need to sort the result in order to have: first the list of all nodes and then the list of the ways, removing all duplicates. I did this, but it doesn't work properly.

 [out:json];
    (
      node['amenity' = 'bar'](44.943, 7.504, 45.174, 7.887) -> .nodes;
      way['amenity' = 'bar'](44.943, 7.504, 45.174, 7.887) -> .ways;
      node(w) -> .nodesMembersWays;
    );
    (
    .nodes;
    .nodesMembersWays;
    .ways;
    );
    out;

Or, if there is a method to directly download the ways with the coordinates of their member nodes, that would be the top.

asked 14 Mar '17, 10:50

CillaLu's gravatar image

CillaLu
31335
accept rate: 0%

edited 14 Mar '17, 11:41


2 Answers:

3

You can do this by using more than one print statement and geom output for the ways:

node['amenity' = 'bar'](44.943, 7.504, 45.174, 7.887);
out;
way['amenity' = 'bar'](44.943, 7.504, 45.174, 7.887);
out geom;

answered 14 Mar '17, 17:27

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Thank you so much, this is exactly what i was looking for.

(18 Mar '17, 15:28) CillaLu

0

In the Wizard of Overpass-turbo try inserting amenity=bar & (type:way | type:node)

answered 14 Mar '17, 12:29

Hjart's gravatar image

Hjart
3.0k42656
accept rate: 18%

Source code available on GitHub .