Skip to content

Instantly share code, notes, and snippets.

@asdqwe3124
asdqwe3124 / vincenty.php
Created July 21, 2018 03:12 — forked from lkacenja/vincenty.php
Vincenty Formula Jacked From Navigator PHP
// Inputs in Radians so degtorad degrees first.
function vincenty($lat1, $lon1, $lat2, $lon2) {
// Equitorial Radius
$a = 6378137.0;
// Polar Radius
$b = 6356752.31424518;
//Flattening of the ellipsoid
$f = 0.00335281066;
// Difference in longitude
$L = $lon2 - $lon1;
@asdqwe3124
asdqwe3124 / vincenty.php
Created July 21, 2018 03:11 — forked from milesich/vincenty.php
Calculate geodesic distance (in meters) between two points specified by latitude/longitude using Vincenty inverse formula for ellipsoids.
<?php
/**
* Calculate geodesic distance (in meters) between two points specified by
* latitude/longitude using Vincenty inverse formula for ellipsoids
*
* from: Vincenty inverse formula - T Vincenty, "Direct and Inverse
* Solutions of Geodesics on the Ellipsoid with application of nested
* equations", Survey Review, vol XXII no 176, 1975
* http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
*