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

Hello, I want to use Overpass to find all Bars and Pubs around one kilometre of a coordinate. I have written there a code on overpass-turbo and tried it out:

[out:json][timeout:25];
(
  node(around:1000.0,54.3233417,10.1237456)[amenity~"^(bar|pub)$"]({{bbox}});
);
out body;
>;
out skel qt;

Now I want to add an exception list for a few object and want to identify them by their Id. So I lokked up, if there is any option to solve it. I tried it to add these code:("id"!="2176294876") and other combinations and got always an error back.

Do you know any possibilities to solve this problem.

Thank you very much :)

asked 07 Sep '18, 18:34

Xadees's gravatar image

Xadees
26112
accept rate: 0%


I would put the ones you dont want into a set and use difference ( seta; - setb ) ;

    [out:json][timeout:25];
    (
      node(around:1000.0,54.3233417,10.1237456)[amenity~"^(bar|pub)$"] ;
    ) -> .possible ;
    (
    node ( 809743532) ;
    node ( 4449144065 ) ;
    ) -> .unwanted;
    ( .possible ; - .unwanted ; ) ;

    out body;
    >;
    out skel qt;

In a bit more detail

  • create a set .possible of all pubs

    (
      node(around:1000.0,54.3233417,10.1237456)[amenity~"^(bar|pub)$"] ;
    ) -> .possible ;
    
  • Create a set .unwanted

    (
    node ( 809743532) ;
    node ( 4449144065 ) ;
    ) -> .unwanted;
    
    • take the difference

      ( .possible ; - .unwanted ; ) ;

Note I have removed the ({{bbox}}) so I could find out where your points are and isn't needed with the (around: ) clause.

permanent link

answered 08 Sep '18, 08:38

andrewblack's gravatar image

andrewblack
3651214
accept rate: 57%

edited 08 Sep '18, 08:45

Thank you very much for your fast answer. It is a nice solution and you explained it very well.

(08 Sep '18, 14:06) Xadees

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:

×483
×228
×85

question asked: 07 Sep '18, 18:34

question was seen: 1,679 times

last updated: 08 Sep '18, 14:06

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