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

Hi, I am trying this for hours now.

How to select ways that are OUTSIDE an area (polygon) with a certain tag?

The following code prints out tracks (overpass turbo). Now, I want the subset of Tracks that are NOT part of polygons with tags like ("boundary"="protected_area"):

[out:json][timeout:25];
(
 way
   ["highway"="track"]
   ({{bbox}}); 
   // remove ways outside of area with tag "boundary"="protected_area"
);
out body;
>;
out skel qt;

asked 05 Apr '18, 11:29

StefanFreilig's gravatar image

StefanFreilig
21112
accept rate: 0%


There are some unclear issues related to your question like: what is the "outside" to your original area (the complementary area relative to the whole Planet or to a larger rectangular polygon enclosing you area), what with the ways crossing the area... just to mention some. Anyway, assuming that the query/filtering model you have mentioned works properly here are some hints/options:
-Using a larger rectangular polygon and your query model select the ways inside the rectangle. So, subtract from that set of ways the ways you have already as a result from before.
-Create a complementary area to your original area and run your query using this as the area argument. To create the complement area is rather simple. Take the larger rectangular polygon and tag it as outer. Add to this the polygons from your original area with opposite rules. This multipolygon now probably represents the "outside" of your original area.
However, be careful. If the set of ways to filter is large and so is the outer polygon of your original area, the procedure to accomplish may take many, many hours. In similar cases you need much more robust and specialized filtering/extracting models than the one you have described.

permanent link

answered 07 Apr '18, 09:17

sanser's gravatar image

sanser
695383955
accept rate: 5%

This is the solution I am working with. It is quite slow though.

[out:json];
area
  ["boundary"="protected_area"]
  ({{bbox}})->.searchArea;

way
  ["highway"="track"]
  ({{bbox}})
  (area.searchArea)->.badTracks;

way
  ["highway"="track"]
  ["tracktype"!~"^grade1$"]
  ({{bbox}})->.allTracks;

(.allTracks - .badTracks;);
(._;>;);
out skel;
permanent link

answered 08 Apr '18, 10:34

StefanFreilig's gravatar image

StefanFreilig
21112
accept rate: 0%

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
×65

question asked: 05 Apr '18, 11:29

question was seen: 3,730 times

last updated: 08 Apr '18, 10:34

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