Skip to main content
Question

How to create a center point from multiple features grouped by an attribute

  • April 28, 2023
  • 3 replies
  • 209 views

ronmak
Contributor
Forum|alt.badge.img+5

I have a large data set that has been read from multiple autocad drawing files. At the current stage each feature has an attribute "project_num". There are many feautres (usually lines) for each project_num. I would like to get this down to a single "centroid coordinate" (preferably center of gravity) for all of the lines from each project_num.

 

CentrePointReplacer will generate a single point for every feature.

I tried FeatureMerger but am having problems. Both the Supplier and Requestor are set to "project_num". I have set the Feature Merge Type to geometry and checked "process Duplicate Suppliers" (build polygons) but get the same number of merged features as the input. If I use the "group processing" option, I still get the same number of merged features.

 

My current workaround is to use the DuplicateFilter before sending it to CenterPointReplacer. I have also tried creating a point cloud from all the resulting CenterPoints and then running CenterPointReplacer on the resulting point cloud.

 

I'm thinking there is a better way to do this!

3 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 627 replies
  • April 28, 2023

You should be able to use an Aggregator with Group By set to 'project_num', then feed those aggregates into the CenterPointReplacer.


ronmak
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 19 replies
  • April 28, 2023

Thanks.

This looks promising but the CenterPointReplacer doesn't seem to like aggregate geometry. It rejects the first one and then terminates with an error.

I notice that CenterPointReplacer now only has two options for modes: "Centerline" or "Straight Skeleton". Both result in the same error.


dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 627 replies
  • April 28, 2023

Thanks.

This looks promising but the CenterPointReplacer doesn't seem to like aggregate geometry. It rejects the first one and then terminates with an error.

I notice that CenterPointReplacer now only has two options for modes: "Centerline" or "Straight Skeleton". Both result in the same error.

Instead of the Aggregator, you might consider using the HullAccumulator with Group By set to the 'project_num'. This should create an area feature around the input features, which you can certainly use in the CenterPointReplacer.