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.
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.
@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.
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.
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.
breaklineintosegments.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?
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.
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.
breaklineintosegments.fmw
@DaveAtSafe Dave, you're a life saver. This works perfect. I can't thank you enough.
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.
breaklineintosegments.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
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.
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.