I have some polygons, but I need points (centroid) with an attribute, which holds the maximum distance from the centroid to the polygon-border. I can get the centroid (centerpointExtractor), but how can I get the maximum distance?
Thanks
Vera
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.
Counter: Add a sequential number attribute (e.g. "_count") to each polygon as temporary unique identifier.
Chopper (Mode: By Vertex, Maximum Vertices: 1): Decompose the boundary of each polygon into individual vertex points.
VertexCreator (Mode: Add Point): Add the center point to each vertex point to form a line segment connecting between the vertex and the center point.
LengthCalculator: Calculate the length for each line segment.
Sorter: Sort the line segments by length descending.
DuplicateFilter (Key Attributes: _count): Pick the first (i.e. the longest) line segment for each polygon. The length of the resulting line is the "maximum distance" of a polygon.
I came up with an alternative solution, but I think the one @takashi came up with is better actually, the downside of mine is that you have to set a max distance in the NeighborFinder and it has to be big enough to catch your maximum centroid-boundary distance.
I see you have an answer, but I will chip in my 2c for posterity and say that the Triangulator transformer might be another solution. Basically compute triangles and select the one with the longest edge. It's what first came to mind for me.
As I was taught as a land surveyor, if in doubt, chop it into triangles!