Skip to main content

Not a question, but a Tip.

 

Sometimes there is a need to convert angles measured in Arithmetic convention (counter-clockwise from the X-Axis) to Geographic convention (clockwise from North/Y-Axis).

 

capture 

For example, Transformers like TopologyBuilder output Edge angles in Arithmetic degree angles whereas Desktop GIS systems like ArcGIS can sometimes default to Geographic degree angles.

 

Instead of using complicated Conditional Value formulae to translate angles quadrant by quadrant with different formulae, searching the internet came up with a genius single formulae that converts angles back and forth, no matter what quadrant the calculated angle is in.

Geographic Angle = (450 - Arithmetic Angle) mod 360

 

Rewriting the formula into FME Maths function format it becomes this

Geographic Angle = @fmod((450 - @Value(Arithmetic Angle)),360)

It also works in reverse:

Arithmetic Angle = @fmod((450 - @Value(Geographic Angle)),360)

Great piece. This should be a transformer.


Great tip, thanks for sharing. I agree that it would make for a great contribution to the FME Hub.


Thanks for the tip!


Reply