Skip to main content
Question

Group features by (spatial) vicinity?


aron
Supporter
Forum|alt.badge.img+16
  • Supporter

I have a shape file with depth readings in various lakes and am trying to find the deapest value in each lake. In order to do this I first need to group the features by vicinity, so that each group represents a lake. Then I can move on to find the highest value in each. Below is a screen dump of my data. What I esentially want to do is to group each of the clusters below by vicinity and then attach a identifying attribute to each group.

I have had a look at neigbourhoodfinder, clustermodeller and a few others, but have not found a way to get any of them to do what I want.

To a human eye the groups in the image below are obvious, and it is sligthy soothing that we can beat the machines now and then, but this time I need the computer to do the work.

12 replies

ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • August 21, 2018

I have done this in the past but it is not particularly efficient.

Buffer everything by the max distance you want between clusters. Then dissolve to produce polygons that cover every feature in the cluster, assign an attribute to define each group and then a spatial relator to assign a group value to each item

You can also use a neighbourfinder along with a listcombiner (custom transformer available on hub) to create groupings. I can post an example later.


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • August 21, 2018

Will probably require some trial and error to work out what distance needs to be used to get some accurate results. I'm not sure exactly how you would expect the middle points to be clustered

cluster.fmwt


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • August 21, 2018

Do you have another dataset that has polygonal lakes? If so, then that would be an easy way of "clustering" the points.

 

 

Alternatively, have a look at the PointClusterer custom transformer.

 

 

We've also had decent success using the RCaller and using various existing clustering algorithms.

aron
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • August 22, 2018

I have polygons for the lakes, but unfortunatly there is no way to identify separate lakes in that file.

I will try your suggestions and see if I can make them work!


takashi
Evangelist
  • August 22, 2018
aron wrote:

I have polygons for the lakes, but unfortunatly there is no way to identify separate lakes in that file.

I will try your suggestions and see if I can make them work!

If you mean that the lake features have no unique identifier attribute, you can use the Counter to add sequential number attribute to the lake features as their temporary identifier.

 


aron
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • August 22, 2018
takashi wrote:
If you mean that the lake features have no unique identifier attribute, you can use the Counter to add sequential number attribute to the lake features as their temporary identifier.

 

Unfortunatly there are sounds and other waterways that connect some of the different lakes, so I cant really brake them appart in their separate enteties.

 

 


aron
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • August 22, 2018
jdh wrote:

Do you have another dataset that has polygonal lakes? If so, then that would be an easy way of "clustering" the points.

 

 

Alternatively, have a look at the PointClusterer custom transformer.

 

 

We've also had decent success using the RCaller and using various existing clustering algorithms.
The PointClusterer asks for a set number of clusters, and I don't really know how many lakes there are. Is there a workaround for that?

 

 


takashi
Evangelist
  • August 22, 2018
takashi wrote:
If you mean that the lake features have no unique identifier attribute, you can use the Counter to add sequential number attribute to the lake features as their temporary identifier.

 

OK. In the case, I would try the Bufferer approach suggested by @egomm. The Clipper or the SpatialFilter can also be used instead of the SpatialRelator in workspace example

ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • August 22, 2018
takashi wrote:
OK. In the case, I would try the Bufferer approach suggested by @egomm. The Clipper or the SpatialFilter can also be used instead of the SpatialRelator in workspace example
On a small amount of test data, I found that using the bufferer was faster than the neighbourfinder option which surprised me, I thought it would be the other way around.

 

 


aron
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • August 22, 2018
ebygomm wrote:

Will probably require some trial and error to work out what distance needs to be used to get some accurate results. I'm not sure exactly how you would expect the middle points to be clustered

cluster.fmwt

In your examples you use a parameter that I have not run into before, $(cluster_distance). What does it do? (Google unfortunatly turned up nothing usefull)

 

 


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • August 22, 2018
aron wrote:
In your examples you use a parameter that I have not run into before, $(cluster_distance). What does it do? (Google unfortunatly turned up nothing usefull)

 

 

It is just a value that gets sent to the bufferer, you would need to decide what is the maximum distance between two points that you would consider to be in the same cluster. So if you think all points in a lake will be within 500m of each other and if they are further away this is likely to be a different lake then you would use 500 as your cluster_distance value.

 

 


aron
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • August 22, 2018
ebygomm wrote:

Will probably require some trial and error to work out what distance needs to be used to get some accurate results. I'm not sure exactly how you would expect the middle points to be clustered

cluster.fmwt

Thanks! The buffer method did the job!

 

 

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings