Skip to main content
Question

Adding centroid fields

  • November 23, 2012
  • 4 replies
  • 29 views

I want to compute a centroid for polygons then add the X and Y fields to my features.  I could not find any way of doing this in FME desktop as I have it. Can anyone suggest how I might do this please?
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

takashi
Celebrity
  • November 23, 2012
Hi,

 

I think that "CenterOfGravityReplacer" and "CoordinateExtractor" are applicable.

Forum|alt.badge.img+1
  • November 23, 2012
Hi, 

 

maybe  "insidepointreplacer"  then "pointonareaoverlayer" are better,  because centerofgravityreplacer generate the point could be outside of the shape.

takashi
Celebrity
  • November 23, 2012
Yes. "CenterOfGravityReplacer" may generate a point outside of the original shape. I understood that "centeroid" means the center of gravity which can be outside of the shape. "CenterOfGravityReplacer" and "InsidePointReplacer", which is more suitable differs according to chrismugdan's demand.  

  • November 23, 2012
Hi,

 

Take your reader,

 

  branch

 

       InsidePointReplacer followed by CoordinatesExtractor

 

                                  ( very fancy to include reprojectors :) )

 

  Merge with original data

 

       FeatureMerger (The best of feature_ID)

 

 Write Results 

 

       Feature-writer

 

             copy attributes from input

 

             add your two X,Y attributes named in the CoordinatesExtractor

 

 

Good Luck

 

(failed to include a picture of the workbench)