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

0
1

For example trees on nodes natural=tree. Most trees have a distance to the other tree. They a planted line or random but mostly with a space between them. If I want to see only the trees that are close by, say less then 5 meter.

[out:json];

(
  node["natural"="tree"]({{bbox}});
)->.a;

(
  node(around.a:5)["natural"="tree"];
);

out body;
>;
out skel qt;

This give all trees even with around.a:0

Of course the node natural=tree is the base, the base is always a distance of 0m. Only to a other node should be calculated.

How to fix this?

asked 05 Sep '18, 00:53

Allroads's gravatar image

Allroads
222161725
accept rate: 10%

edited 05 Sep '18, 15:16


You need to evaluate the trees one at a time and subtract the base tree from the around result:

[out:json];
(
  node["natural"="tree"]({{bbox}});
)->.a;
foreach.a->.tree(
  node(around.tree:10)["natural"="tree"];
  (._; - .tree;) -> .others;
  (.collect; .others;) ->.collect;
);
.collect out;

(setting around.tree to 5 returns 0 results at the location there)

permanent link

answered 05 Sep '18, 12:47

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Thanks, it works. A little slow, when I take a bigger area or a adm_level.

(05 Sep '18, 15:18) Allroads
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:

×483
×63
×9

question asked: 05 Sep '18, 00:53

question was seen: 1,633 times

last updated: 05 Sep '18, 15:18

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