Subscribe to this thread
Home - General / All posts - identify clustered points
sour

126 post(s)
#14-Mar-24 08:14

hello asking for help!

I have points that represents as meters. some points are singles, some points and some points are clustered.

Heres the concern: i don't have attributes that this meter is single or clustered, is there a way in manifold that willl hellp me identify clustered points:

in this condition: identify clustered by : points less than the distance of 1 foot and clustering (or in series of)in more than 10 points.

im using manifold 8.0

thank you!

Dimitri


7,497 post(s)
#14-Mar-24 13:02

There are a variety of ways to approach this but brute force overlays I think would work well.

I'd usually use 9 for that, as it is a simple Join operation. In 9, create buffers on each point with a 1 foot radius. Next, see this example. That teaches you how to add a "touch count" to each object. Do that procedure for the buffers. If the count is zero it touches no other objects. In your case, if the count is 10 that means the buffer overlaps with at least 9 other buffers. You can use the Select pane to select all other objects with a touch count greater than 10 to zero in on where points are clustered.

You could do something analogous in 8 using spatial overlays (I haven't done the following but I believe it is similar to what the topic in 9 does and should work for you). Create a layer that is 1 foot buffers made from your points. Add an attribute to each buffer called "count" which is set to 1. You could then use a spatial overlay in 8 to transfer the sum of the Count values for all buffer areas that contain each point to that point. Those points with counts above 10 are in clusters of 10 or more points within a foot of each other.

artlembo


3,425 post(s)
online
#20-Apr-24 14:20

I prefer using 8, as well, given the simplicity of the SQL the nice cut/paste capabilities of tables, and the less overhead of managing indexes. I reserve 9 for simply working with larger data sets. But if there are under 150,000 objects, I much prefer 8. So, here is the example you can try. I have a drawing called [D].

Here is how you get the distance from every point to every other point:

SELECT a.id, b.id, Distance(a.id, b.id) AS dist

FROM [D] AS a, [D] AS b

WHERE a.id <> b.id

now, what you want to do is find those points that are within a specified distance. So, I wrap that in a sub query like this:

SELECT *

FROM 

 (SELECT a.id, b.id, Distance(a.id, b.id) AS dist

 FROM [D] AS a, [D] AS b

 WHERE a.id <> b.id

 )

WHERE dist < 50

now, if you want the number of points that are within the cluster you simply make a small change and add a GROUP BY:

SELECT a.id, count(*) AS numpoints

FROM 

 (SELECT a.id, b.id, Distance(a.id, b.id) AS dist

 FROM [D] AS a, [D] AS b

 WHERE a.id <> b.id

 )

WHERE dist < 50

GROUP BY a.id

finally, if you have two columns named [numneighbors] and [cluster], you can easily update that column with a slight modification to the above query:

UPDATE (SELECT *

FROM D,

 (SELECT a.id, count(*) AS numpts

 FROM [D] AS a, [D] AS b

 WHERE a.id <> b.id

 AND Distance(a.id, b.id) < 50

 GROUP BY a.id) AS t1

WHERE d.id = t1.id)

SET cluster = 1, numneighbors = numpts

So, this last query is all you need. I like this because you aren't creating artifacts like buffers along the way. I also love how 8 handles updates - it's non standard SQL, but it makes things super convenient. If you want more help, feel free to contact me.

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.