Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 673 Bytes

distance_calculations.rst

File metadata and controls

21 lines (15 loc) · 673 Bytes

Distance calculations

PHPCoord can calculate the distance between two Points via the calculateDistance() method.

public function calculateDistance(
    Point $to,
): Length
  • The distance between two ProjectedPoints is calculated via Pythagoras
  • The distance between two GeographicPoints or two GeocentricPoints is calculated via Vincenty's formula
  • The distance between two VerticalPoints is calculated as simple difference

Example

$from = GeographicPoint::create(...);
$to = GeographicPoint::create(...);
$distance = $from->calculateDistance($to);