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:34

Xadees's gravatar image

Xadees
262
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, 08:38

andrewblack's gravatar image

andrewblack
2061211
accept rate: 100%

edited 08 Sep, 08:45

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

(08 Sep, 14:06) Xadees
Your answer
toggle preview

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:

×313
×100
×56

question asked: 07 Sep, 18:34

question was seen: 183 times

last updated: 08 Sep, 14:06

powered by OSQA