# Calculate the distance between two point of different geometry

## Recommended Posts

Hi, i've two geometry with a scatter node applied and i wont connect these point using an add node by color attribute create with a color node after scatter node.
so...

geo 1                      geo2
scatter1                   scatter2
color1                     color2
merge

Now i need to calculate the distance between the connected poit.
How can I do?

Thanks

##### Share on other sites

in wrangle connect your 2 streams and use the distance function

```vector mypt = point(1, "P", 0);
f@dist = distance(@P, mypt);```

##### Share on other sites

Ok, i suppose that I have to connect my two streams in the first and second imput of attributewrangle, right?

Sorry my ignorance...

And furthermore, if i would to delete the longest line of a certain value, how can select these line? (line created with the connection of points)

i forgot a piece of the message

##### Share on other sites

Not on my computer right now but yes you have connect your 2 streams in the wrangle.
for the other question you could do an if statement and do something along this lines.

```if(@dist > ch("threashold")){
removepoint(0, @ptnum);
}```

##### Share on other sites

Ok i really thank you for the help! I tried and it works!

Really thank you!

##### Share on other sites

Just wanted to add a quick something to this: you can actually access another input's attributes without having to use the point function.

Appending opinput# before the attribute allows you to designate which input to access.

v@opinput1_P would access the second input's P attribute for instance. So you could actually get the distance with a single line

`f@dist = distance(@P, v@opinput1_P);`

## Create an account

Register a new account