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

# Overpass: check double node elements nearby

 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 222●16●17●25 accept rate: 10%

 2 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) answered 05 Sep '18, 12:47 maxerickson 12.7k●10●83●176 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

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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,770 times

last updated: 05 Sep '18, 15:18

### Related questions

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