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
168121321
accept rate: 0%

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
10.7k1073150
accept rate: 31%

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:

×350
×46
×7

question asked: 05 Sep '18, 00:53

question was seen: 450 times

last updated: 05 Sep '18, 15:18

powered by OSQA