NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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


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;
permanent link

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

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

permanent link

answered 14 Mar '17, 12:29

Hjart's gravatar image

Hjart
3.0k42656
accept rate: 18%

Follow this question

By Email:

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

By RSS:

Answers

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:

×147
×54

question asked: 14 Mar '17, 10:50

question was seen: 2,756 times

last updated: 18 Mar '17, 15:28

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum