Skip to content

GeoAxis

Which coordinate a number is: latitude (north-south) or longitude (east-west).

A coordinate is just a number, and the number alone cannot say which axis it belongs to — 40.7128 could be either. The axis decides two things: the allowed range (a latitude runs -90 to 90, a longitude -180 to 180) and the hemisphere letter the value gets when written as degrees, minutes and seconds — the 40°42'46.1"N style a map uses (N or S for a latitude, E or W for a longitude). So the writer asks you, with a GeoAxis parameter.

Members

Member Meaning
Latitude North-south: -90 (the South Pole) to 90 (the North Pole); the letter is N or S. This is the default.
Longitude East-west: -180 to 180, counted from the Greenwich meridian (the zero line through Greenwich, London); the letter is E or W.

Where it is used

The DecimalToDms method on CkGeo takes it as its axis parameter, to pick the range check and the hemisphere letter. The other CkGeo methods manage without it: Latitude, Longitude and their OrNull twins say their axis in their own name, and DmsToDecimal reads one angle without knowing which axis it belongs to.

Quick look

using SafeCoder.CommonKit;
using SafeCoder.CommonKit.Enums;

CkGeo.DecimalToDms(40.7128);          // -> "40°42'46.1"N"  (latitude is the default)

CkGeo.DecimalToDms(
    degrees: -74.006,
    axis: GeoAxis.Longitude
);                                    // -> "74°0'21.6"W"

CkGeo.DecimalToDms(100);              // -> ""  (past 90, so it cannot be a latitude)