azimuth2compass

azimuth2compass(double azimuth [, int resolution [, int verbosity]])

The azimuth2compass function converts a numerical azimuth value (degrees of rotation from 0 degrees north) and converts it into a compass heading, such as N or Southeast. The exact text returned is controlled by two optional parameters, resolution and verbosity.

Resolution determines how fine-grained the values returned are. There are 4 possible values:

  • 1 - Only the four cardinal directions are used (N, E, S, W)

  • 2 (default) - Inter-cardinal directions (N, NE, E, etc.)

  • 3 - In-between inter-cardinal directions (N, NNE, NE, ENE, E, etc.)

  • 4 - "by" values (N, NbE, NNE, NEbN, NE, NEbE, ENE, EbN, E, etc.)

Verbosity affects how verbose the resulting text is. There are two possible values:

  • 1 (default) - Use initials for direction values (N, NbE, NNE, etc.)

  • 2 - Use full text for direction values (North, North by east, North-northeast, etc.)

For an azimuth value of 105, here are some example results of azimuth2compass:

azimuth2compass(105): E
azimuth2compass(105, 3): ESE
azimuth2compass(105, 4): EbS
azimuth2compass(105, 1, 2): East
azimuth2compass(105, 3, 2): East-southeast
azimuth2compass(105, 4, 2): East by south


Copyright © Thunderstone Software     Last updated: Oct 5 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.