Solved

Get polygon perimeter dimensions from irregular polygons

  • 10 September 2018
  • 16 replies
  • 40 views

Hello,

I have a shapefile with various polygons on land parcels. I've been tasked figure out the dimensions of the polygons and display them on a map for engineers and planners to examine.

How would I go about this using FME 2018.1?

Since some of the polygons have curves, I figured I would use the PolylineAnalyser tool from the Hub and use the Segment output. Then use the Sorter to first sort by the ObjectID and then by the angle of the segment. Then I wanted to merge line segments that are within a 2-3 degrees range of each other so I would get a continuous line, instead of a bunch of small lines to make up a side of a polygon.

Perhaps I'm going about this entirely wrong and there is an easier way to do this. Any help would be appreciated.

Thank you

icon

Best answer by mariofederis 25 September 2020, 21:38

View original

16 replies

Userlevel 1
Badge +21

The length calculator will calculate the perimeter of a polygon

The length calculator will calculate the perimeter of a polygon

Hello,

 

Yes, however, we want to calculate each dimension of the polygon. However, when the polygon is broken into line segments, there are many segments per each side (because the polygons are somewhat irregular and what have arcs, etc). I'm trying to get around that aspect of it.
Userlevel 4

What exactly do you mean by "dimension" in this context?

What exactly do you mean by "dimension" in this context?

@david_r Hi David, What I'm trying to calculate is the length dimension for the side of the polygon. But the difficult part is to summing up all the segment lengths that make up a side of the polygon.

 

Ex. See the highlighted line segment, I want to determine the orientation of the segment (angle, I suppose) and merge the segments to the right and the left so I have a continuous line and THEN calculate the length. I know how to calculate the length, it's the merging of the line segments with similar angles I have an issue with.

 

I also realize this causes another issue where lines at different parts of the polygon might share similar angles (depending on how they were drawn), so I guess we have to determine adjacency as well.
Userlevel 4
@david_r Hi David, What I'm trying to calculate is the length dimension for the side of the polygon. But the difficult part is to summing up all the segment lengths that make up a side of the polygon.

 

Ex. See the highlighted line segment, I want to determine the orientation of the segment (angle, I suppose) and merge the segments to the right and the left so I have a continuous line and THEN calculate the length. I know how to calculate the length, it's the merging of the line segments with similar angles I have an issue with.

 

I also realize this causes another issue where lines at different parts of the polygon might share similar angles (depending on how they were drawn), so I guess we have to determine adjacency as well.
Agreed, it's going to take a little bit of work. Sounds like you'll want to look into the VertexAngleCalculator, HorizontalAngleCalculator and the PolylineAnalyzer transformers on the FME Hub, maybe some of them can help.
Agreed, it's going to take a little bit of work. Sounds like you'll want to look into the VertexAngleCalculator, HorizontalAngleCalculator and the PolylineAnalyzer transformers on the FME Hub, maybe some of them can help.
Thank you, @david_r! I will look into those transofrmers.
Userlevel 2
Badge +17

Hi @rich90599,

The attached workspace uses the TopologyBuilder to break the polygons into segments and calculate the angle between the segments. Any angle over the user chosen threshold (0-90 degrees) sets a trigger attribute on the segment.

A combination of Counter, VariableSetter and VariableRetriever are used to group the segments between triggers, then a LineCombiner joins the groups together into a line for measurement.

joinsegmentsbreaklineintosegments.fmw

Hi @rich90599,

The attached workspace uses the TopologyBuilder to break the polygons into segments and calculate the angle between the segments. Any angle over the user chosen threshold (0-90 degrees) sets a trigger attribute on the segment.

A combination of Counter, VariableSetter and VariableRetriever are used to group the segments between triggers, then a LineCombiner joins the groups together into a line for measurement.

joinsegmentsbreaklineintosegments.fmw

Wow, thank you, @DaveAtSafe! You didn't have to put this much effort into this but I've very grateful! I will play around with this and report the results! Cheers

 

Wow, thank you, @DaveAtSafe! You didn't have to put this much effort into this but I've very grateful! I will play around with this and report the results! Cheers

 

Hi @DaveAtSafe, thanks again for the solution. It works great, however, I'm still getting sections where the lines aren't segmented (or joined) even though they're in the same plane.

 

See image:

It seems the angle of these lines are off. I grabbed the angle from the "@Value(_node_angle{0}.fme_arc_angle)" variable. The selected line has an angle of 8 degrees. While the line to the left has an angle of 270. Is this due to how the segments were digitized or a result of running it through the TopogyBuilder?
Userlevel 2
Badge +17
Hi @DaveAtSafe, thanks again for the solution. It works great, however, I'm still getting sections where the lines aren't segmented (or joined) even though they're in the same plane.

 

See image:

It seems the angle of these lines are off. I grabbed the angle from the "@Value(_node_angle{0}.fme_arc_angle)" variable. The selected line has an angle of 8 degrees. While the line to the left has an angle of 270. Is this due to how the segments were digitized or a result of running it through the TopogyBuilder?
Hi @rich90599,

 

I think the expression I used to calculate the angle difference should be able to handle that case. However, there is no replacement for real data testing. Would you mind sending me a copy of the polygon in question, so I can see where the process is going wrong? If you don't want to make it public, you can send it to me directly at dave.campanas@safe.com.

 

Userlevel 2
Badge +17
Hi @DaveAtSafe, thanks again for the solution. It works great, however, I'm still getting sections where the lines aren't segmented (or joined) even though they're in the same plane.

 

See image:

It seems the angle of these lines are off. I grabbed the angle from the "@Value(_node_angle{0}.fme_arc_angle)" variable. The selected line has an angle of 8 degrees. While the line to the left has an angle of 270. Is this due to how the segments were digitized or a result of running it through the TopogyBuilder?
Hi @rich90599,

 

I modified the angle calculations to better find the adjoining edges, and also added some logic to allow joining the start and end segments if they are within the tolerance.

 

I will modify my first answer with the updated workspace and screenshot as well.

 

breaklineintosegments.fmw

 

Hi @rich90599,

The attached workspace uses the TopologyBuilder to break the polygons into segments and calculate the angle between the segments. Any angle over the user chosen threshold (0-90 degrees) sets a trigger attribute on the segment.

A combination of Counter, VariableSetter and VariableRetriever are used to group the segments between triggers, then a LineCombiner joins the groups together into a line for measurement.

joinsegmentsbreaklineintosegments.fmw

@DaveAtSafe Dave, you're a life saver. This works perfect. I can't thank you enough.
Badge

Hi @rich90599,

The attached workspace uses the TopologyBuilder to break the polygons into segments and calculate the angle between the segments. Any angle over the user chosen threshold (0-90 degrees) sets a trigger attribute on the segment.

A combination of Counter, VariableSetter and VariableRetriever are used to group the segments between triggers, then a LineCombiner joins the groups together into a line for measurement.

joinsegmentsbreaklineintosegments.fmw

Is this workspace for this still available? I don't see it on the thread anymore

Is this workspace for this still available? I don't see it on the thread anymore

Hmm, can't see it either. In any case, here is the workbench Dave provided me with.

Cheers,

Ruch

Userlevel 2
Badge +14

Is this workspace for this still available? I don't see it on the thread anymore

Hi @mariofederis​ I've fixed the workspace link, but I've also attached it to this comment. Thanks for reporting the missing file.

 

Userlevel 2
Badge +17

Is this workspace for this still available? I don't see it on the thread anymore

Hi @mariofederis​ ,

The link to the workspace should be restored now.

Reply