Skip to main content
Solved

Group points spatially and calculate their average positions


Forum|alt.badge.img

I have a few hundreds of points and I'm trying to:

1) 'Cluster' them spatially (max distance 25cm) and based on one common attribute while the number of neighbors can vary from 0 to 5

2) Calculate average position for each 'cluster' of points and replace their geometry so that all aggregated points have the same position (of course keeping the original attributes).

I would be grateful for a hint, I've been trying different transformers and I can't find a solution.

Best answer by erik_jan

1) NeighborhoodAggregator generates the groups

2) CenterpointExtractor calculates the X and Y of the center point of the group

VertexCreator replaces the geometry by a point using the X and Y

View original
Did this help you find an answer to your question?

4 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • Best Answer
  • January 8, 2018

1) NeighborhoodAggregator generates the groups

2) CenterpointExtractor calculates the X and Y of the center point of the group

VertexCreator replaces the geometry by a point using the X and Y


Forum|alt.badge.img
  • Author
  • January 8, 2018

Hi @erik_jan,

thanks for your reply! I tried NeighbourhoodAggregator, but from there I had to work with lists if I wanted to keep all attributes (is that correct?). This is where I got stuck, I didn't know how to handle the lists and extract centerpoints. Is it possible?


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 8, 2018
kajciuk wrote:

Hi @erik_jan,

thanks for your reply! I tried NeighbourhoodAggregator, but from there I had to work with lists if I wanted to keep all attributes (is that correct?). This is where I got stuck, I didn't know how to handle the lists and extract centerpoints. Is it possible?

You can use the ListExploder after the CenterpointExtractor to create the individual objects (including the calculated X and Y and the original attributes).

 

 


Forum|alt.badge.img
  • Author
  • January 8, 2018
erik_jan wrote:
You can use the ListExploder after the CenterpointExtractor to create the individual objects (including the calculated X and Y and the original attributes).

 

 

This was indeed my missing element! Thank you

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