Distance calculations
PHPCoord can calculate the distance between two Point
s via the calculateDistance()
method.
public function calculateDistance(
Point $to,
): Length
The distance between two
ProjectedPoint
s is calculated via PythagorasThe distance between two
GeographicPoint
s or twoGeocentricPoint
s is calculated via Vincenty’s formulaThe distance between two
VerticalPoint
s is calculated as simple difference
Example
$from = GeographicPoint::create(...);
$to = GeographicPoint::create(...);
$distance = $from->calculateDistance($to);