Question

Group features by (spatial) vicinity?


Badge +14
  • Contributor
  • 120 replies

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

Userlevel 1
Badge +21

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.

Userlevel 1
Badge +21

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

Badge +22

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.
Badge +14

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!

Userlevel 2
Badge +17

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.

 

Badge +14
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.

 

 

Badge +14

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?

 

 

Userlevel 2
Badge +17
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
Userlevel 1
Badge +21
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.

 

 

Badge +14

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)

 

 

Userlevel 1
Badge +21
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.

 

 

Badge +14

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!

 

 

 

 

Reply