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

1
2

Hey,

Another Overpass QL question. I'm using Overpass Turbo and trying to realise the following query:

General:

I'm trying to get nodes with a certain tag that are connecting two ways. The nodes should be filtered out, if both of these ways are not corresponding with a set of tags. So both ways can have unequal values of the same key, but have to be defined in the given set. Ways with the same tag shouldn't be discarded.

Excplicit:

I want all nodes that have the tag barrier=lift_gate. These nodes should connect at least two ways, which are tagged as highway=living_street or highway=residential. (So that ways with tags like highway=service or highway=track should be discarded).

Thanks in advance!

asked 04 Jan '15, 13:50

kerosin's gravatar image

kerosin
411131627
accept rate: 0%

edited 04 Jan '15, 13:53


Filtering based on counting something is outside of the scope of Overpass API (as of today), so a bit of post processing is required.

The closest way I could think of is the following: for each barrier=lift_gate node in a bbox, we first print the OSM node id, followed by the number of OSM ways, which are either living_street or residential. As an example, this query will return node 304989602 with two connected ways. Your task would then be to filter out node ids with less than 2 ways, which could be done in Excel or LibreOffice.

[out:csv(::id,::count)]
[bbox:{{bbox}}];
node[barrier=lift_gate];
foreach(
  out;  
  way(bn)[highway~"^(living_street|residential)$"];
  out count;
);

http://overpass-turbo.eu/s/6PS

permanent link

answered 04 Jan '15, 18:07

mmd's gravatar image

mmd
5.7k15388
accept rate: 37%

edited 04 Jan '15, 18:09

1

Thanks again :) I said "at least two ways" and I meant two or more ways. I don't want to count the ways, so if it is problematic I would be very happy for a solution that simply gives all nodes with "barrier=lift_gate" and if there are ways that this node is connected to they should be part of the given set (residential/livingstreet) (should I open again a new question? ;)) A out of the box solution on Overpass would be really great! Anyway great work, I appreciate it!

(05 Jan '15, 00:52) kerosin

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:

×228
×65

question asked: 04 Jan '15, 13:50

question was seen: 6,279 times

last updated: 05 Jan '15, 00:52

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