Skip to main content

hello there we need to calculate the length of each polygon edge , the polygona could be in irregular shape considering the polygon is 4 edges 
if we use chopper or Geometrycoercer  transformer we get many edge  we are suppose to get only 4 
Thanks
 

 

You can use a BoundingBoxReplacer, with the option to use a 2D oriented bounding box. It’ll be rectangular and will generate attributes for the length of the long and short sides (so multiply both by 2 to get the total circumference

If you need to retain the original geometry you can use a GeometryExtractor before and a GeometryReplacer after the BoundingBoxReplacer.


if I use the bounding box we will not get the exact value of the edge length for each side 


c


Can you provide some more information?

Of which 4 edges do you want to calculate the length?

Below I sketch 3 different possible definitions, but maybe you want yet another one.

 


@geomancer 
Thanks for the your response 
the Goal is to extract each  4 line and calculate their length 
as its is presented in color 

 

 


I can think of an algorithm for this particular polygon, but it will not work for all polygons.

For this polygon I would isolate the 2 longest segments, and combine the other segments if they are connecting to each other.

But this will not work when the two longest segments of your polygon share a vertex, or when the long segments are made up of several shorter segments. So this is by no means a complete solution.

The attached workspace makes use of the custom transformer PolylineAnalyzer from FME Hub. This transformer calculates a lot of other useful information, that may lead to other solutions.

 


I can think of an algorithm for this particular polygon, but it will not work for all polygons.

For this polygon I would isolate the 2 longest segments, and combine the other segments if they are connecting to each other.

But this will not work when the two longest segments of your polygon share a vertex, or when the long segments are made up of several shorter segments. So this is by no means a complete solution.

The attached workspace makes use of the custom transformer PolylineAnalyzer from FME Hub. This transformer calculates a lot of other useful information, that may lead to other solutions.

 

@geomancer   thanks for your help

Very useful 

 


@geomancer 
if we need to calculate the edge length for the below case what will be your approach
thanks 
 

 


For this, I would start with isolating the 4 longest line segments, create a new polygon from those segments, and calculate the length of the 4 sides of that polygon.

Like my previous idea I suspect this may not work for all polygons.

 


Reply