# Tutorial: Degrees, Radians and Minutes

The coordinates returned from the Geolake API are a latitude and longitude in degrees in decimal form. The latitude is 0 at the Equator and goes to +90 at the North Pole and -90 at the South Pole. The longitude is 0 at Greenwich, England and goes down to the west to -180 and up to the east to +180.

In some cases, it might be more convenient to work with the coordinates in radians, or in degrees with minutes and seconds, for example:
`1° 45' 30" S, 2° 30' 40" E`

## Decimals vs Minutes and Seconds

The Geolake API returns value in decimal degrees. In decimals, the value halfway between 1 degree and 2 degrees is simply 1.5 degrees.

Another popular notation for coordinates uses minutes and seconds, where the value halfway between 1 and 2 degrees is 1 degree and 30 minutes. This is usually shown in the format: `1° 45' 30" S`, meaning 1 degree, 45 minutes and 30 seconds in the southern hemisphere.

Decimal coordinates can also be negative. When coordinates are shown with minutes and seconds, they are usually not positive or negative, but rather indicated by a wind direction.

`Latitudes: positive is N, negative is S`
`Longitudes: positive is E, negative is W`

The conversion from decimals to minutes and seconds is simple:

`1 degree = 60 minutes`
`1 minute = 60 seconds`

### Javascript conversion

``````/*
* Convert decimal degrees to degrees, minutes and seconds.
* @param decimalDegrees Coordinate in decimal degrees, as returned from the Geolake API
* @param isLatitude True for latitudes, false for longitudes
* @return Formatted coordinate
*/
function decimalToMinutes(decimalDegrees, isLatitude) {
var absDegrees = Math.abs(decimalDegrees);
var degrees = Math.floor(absDegrees);
absDegrees -= degrees;
var minutes = Math.floor(absDegrees * 60);
absDegrees -= minutes / 60;
var seconds = Math.floor(absDegrees * 3600);
var suffix = "";
if(isLatitude) {
suffix = decimalDegrees >= 0 ? "N" : "S";
} else {
suffix = decimalDegrees >= 0 ? "E" : "W";
}

var formattedDegrees = degrees + "\u00B0 " + minutes + "'' " + seconds + "\" " + suffix;
`radians = degrees * PI / 180`
`degrees = radians * 180 / PI`