Skip to content

Instantly share code, notes, and snippets.

@cosinekitty
Created December 5, 2019 01:44
Show Gist options
  • Save cosinekitty/6c66dc21bb0d9df9c3bec202115d7cbe to your computer and use it in GitHub Desktop.
Save cosinekitty/6c66dc21bb0d9df9c3bec202115d7cbe to your computer and use it in GitHub Desktop.
Convert geodetic latitude to geocentric latitude using WGS 84
function GeocentricLatitude(lat)
{
// Convert geodetic latitude 'lat' to a geocentric latitude 'clat'.
// Geodetic latitude is the latitude as given by GPS.
// Geocentric latitude is the angle measured from center of Earth between a point and the equator.
// https://en.wikipedia.org/wiki/Latitude#Geocentric_latitude
var e2 = 0.00669437999014;
var clat = Math.atan((1.0 - e2) * Math.tan(lat));
return clat;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment