Skip to main content
Question

How to calculate Center Point coordinates (x,y) of shorter side of polygon?

  • February 10, 2022
  • 2 replies
  • 29 views

katt
Supporter
Forum|alt.badge.img+12
  • Supporter

I have 18 polygons in a database. I want to retrieve the x and y value of each CenterPoint of the shorter side of each polygon (approximately where the red dot is on image). I also want to create a new attribute called sequence. The first polygon on the left should get the value 1, the second value 2, the third one value 3 and so on. How can I achieve this ?

image

2 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • February 10, 2022

Hi @katt​,

To sequence, use a BoundsExtractor to get the XMax of the polygons, then a Sorter to sort on XMax, ascending. After sorting, use a Counter to assign the sequence number.


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • February 10, 2022

Hi @katt​,

To generate the center points:

  • Dissolver to dissolve all the polygons into one
  • GeometryCoercer to convert new polygon to line
  • Chopper to chop into 2-vertex segments
  • LengthCalculator to calculate length of segment
  • Sorter to sort by length, descending
  • Sampler to Sample First N Features and Sample rate of 2
  • Use NotSampled output of Sampler to get the short segments only
  • CenterpointReplacer with Mode Center Point of Bounding Box to get center point of segments

 


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