# Lat Long

Converts latitude expressed in degrees, minutes and seconds into Degrees.

Controller: **CodeCogs**

doublelatitude( | int | degrees | |

int | minutes` = 0` | ||

float | seconds` = 0` | ||

char | compassDirection` = 'N'` | ) |

Converts a geographical location in degrees, minutes and seconds into a single numeric angle from the center of the earth, expressed in Degrees.
There are a total of 180 degrees from the South pole to the North pole. By convention there are 60 minutes in one degree, and naturally 60 seconds in each minute.

### Example 1

#include <codecogs/maths/geometry/spherical/latlong.h> #include <iostream> int main() { std::cout << "New York is at a Latitude of: " << latitude(40,47,0,'N') << " degrees" << std::endl; std::cout << "London is at a Latitude of: " << latitude(51,32,0,'N') << " degrees" << std::endl; return 0; }

Output:New York is at a Latitude of: 40.7833 degrees London is at a Latitude of: 51.5333 degrees

### Parameters

degrees Degrees from -90 to 90 minutes Minutes from 0 to 60. seconds Seconds from 0 to 60. compassDirection The key direction either 'N' for North, or 'S' for South.

##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

## Longitude

doublelongitude( | int | degrees | |

int | minutes` = 0` | ||

float | seconds` = 0` | ||

char | compassDirection` = 'N'` | ) |

Returns an geographical location in degrees, minutes and seconds as a single numeric angle from the center of the earth, expressed in Degrees.
There are a total of 360 degrees around the world. By convention there are 60 minutes in one degree, and naturally 60 seconds in each minute.

### Example 2

#include <codecogs/maths/geometry/spherical/latlong.h> #include <iostream> int main() { std::cout << "New York is at a Longitude of: " << longitude(73,58,0,'W') << " degrees" << std::endl; std::cout << "London is at a Longitude of: " << longitude(0,5,0,'W') << " degrees" << std::endl; return 0; }

Output:New York is at a Longitude of: -73.9667 degrees London is at a Longitude of: -0.0833333 degrees

### Parameters

degrees Degrees from -180 to 180. if you need to go futher than 180 degrees east or west, then you should describe that location from the opposite direction. minutes Minutes from 0 to 60. seconds Seconds from 0 to 60. compassDirection The key direction either 'N' for North, or 'S' for South.

##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.