Find THE closest point from a set of points to other points

Hello, I m trying to get one closest point from a group of point to a other group of points.
My goal is to find the nearest location for every building in a city quarter, so this location would be the less longest distance for every inhabitant of this quarter to meet.
So I got 77 ground planes of buildings, I took from them the centroid, to use them as attractor points.


Next I build a Square Grid, covering all the area of the 77 centroids. (With the parameter of square grid I can define the resolution of its points).
Now I want to find one/the closest point to all of my attractor points from the Square Grid points using Closest Point Component. But I’m not getting it right.
Instead of getting a unique point from the grid, I always end up with each Grid point being the closest to each attractor point..
Anybody knows how I get only one Point from the grid, THE closest for all attractor point? I would gladly appreciate any suggestion.

Welcome, seems like you just need to graft the attractor points so that each individual one looks for a closest point among the grid points.

2 Likes

@diff-arch is probably right.

In addition I can suggest some Graph theory plugins to use if you’re analysing things like these. Mine (Megarachne | Food4Rhino) or Dachaun’s (LeafVein | Food4Rhino) will help you to analyse buildings in terms of closest paths and other once you will turn this grid into a graph :wink:

1 Like

Thanks for the quick reply! I just tried it out but I got same results

Nice thanks I’ll take a look at it! :slight_smile:

I once used Ladybug, also a very powerful plugin to do building analysis.

Judging from your screenshots, it seems to work. What do expect to work differently?

nearest.gh (12.4 KB)
elena_nearest.3dm (1.8 MB)
Here are the files if anyone would like to have a look.

I just want a unique point which would be the nearest for all an not for each one the closest.

Here are three methods for finding an approximation:

Finding the real point would probably necessitate a much complexer algorithm.

Or it’s found by the first method (pink point), but I’m not entirely certain.

nearest2.gh (22.5 KB)

1 Like

Wow many thanks for your time!
I think the pink one should be right. I would never have used the average component. I don’t quite understand what it does but it seems to work.^^ You are the best! :wink:
This is a great community thanks a lot for that!

It averages all the values that you pass in! If you pass in 10, 3, and 17, it returns 10, because (10 + 3 + 17 ) / 3 = 10. For points, it does the same. It adds all their x-, y-, and z-values together and divides them by the number of points that you input, from which an average point results.

1 Like

OK nice pretty powerful!

I simplied your file a bit ( don’t need 2x closest point) with the same result

1 Like