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

I'm trying to retrieve the forests within a specific (relatively small) bounding box with Overpass API. I'm using the following query:

[out:json][timeout:25];
(
  way["landuse"="forest"]({{bbox}});
  relation["landuse"="forest"]({{bbox}});
);
out body;
>;
out skel qt;

When the edge of the forest intersects my bounding box, the query works as intended:

alt text

But once the bounding box is completely inside of the forest, I receive no results:

alt text

Is there any way to fix this?

asked 27 Nov '18, 09:15

misotrnka's gravatar image

misotrnka
16112
accept rate: 0%


It's not a 100% answer, but for forests with names, you can retrieve them using is_in:

is_in(48.21634,17.12552) ->.in;
(
 way(pivot.in)[landuse=forest];
 rel(pivot.in)[landuse=forest];
);
out geom;

the is_in operator returns Overpass-API areas, the pivot statements retrieve the underlying geometries related to those features. You can look in https://github.com/drolbr/Overpass-API/blob/master/src/rules/areas.osm3s to see the rules for the features that will be returned by is_in.

permanent link

answered 27 Nov '18, 14:48

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Thank you, this actually works perfectly. I just need to make a query with a bounding box and another query for the center point.

(28 Nov '18, 07:38) misotrnka

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

question asked: 27 Nov '18, 09:15

question was seen: 2,553 times

last updated: 28 Nov '18, 07:38

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