Skip to main content

I have a lot of polygons that represent buildings and I want to rasterise them but before I do I need all the polygons to be parallel to the horizon. I need to create a tool that calculates the polygon angles and then use these angles to rotate the buildings accordingly. 

Hi @yahyanar 

 

Please, could you send a dataset to test?


Hi,

 

here I uploaded some buidlings which I want to calculate the dominant angles and use them to rotate the buildings to get them horizontal.

 

thanks in advance


Hi @yahyanar Try this

which uses the BoundingBoxReplacer to get the angle of the longest side.


Hi @DanAtSafe,

 

Thank you very much for your support. I will try it and give you a feedback.

 

 


Hi DanAtSafe,

 

I am using FME 2021.2 and it seems that BoundingBoxReplacer does not have Long Side Angle parameter. When I choose Replace with: 2D Oriented Bounding Box, I got only 2 options (see attached).

any suggestions?


Hi @yahyanar The azimuth was added to BoundingBoxReplacer in FME 2022.1

Here’s the work-around if you can’t upgrade:

 


Hi @DanAtSafe,

 

Thank you very much. 

I have used HorizonAngleCalculator instead of AzimuthCalculator (HAC is upgrad version of AC). However, as you can see in the figure attached only one feature of the center points entered the process and finally, I got rejected. 


Hi @yahyanar Did you change the ExpressionEvaluator so that it calculates the angle to rotate with _angle instead of acAngle?  In your Navigator, go to Workspace Parameters/Translation and change “Rejected Feature Handling” to “Continue Translation”.  Then you’ll be able to see the reason why FeatureMerger_3 is rejecting features.


Hi @DanAtSafe,

 

Yes I have changed the ExpressionEvaluator to _angle. Also, I have changed the workspace parameters and I got the results attached.

 


Hi @DanAtSafe ,

 

I did some changes where I have added a “Sorter” and I “FeatureMerger” and now the script works probably. 

here is the result

 


Reply