The Geo Distance calculator is a powerful tool designed to determine the distance between two geographic locations on the Earth’s surface. Whether you are planning a trip, conducting research, or managing logistics, understanding the distance between points is crucial for effective decision-making.
composer require davidvandertuijn/geodistance
use Davidvandertuijn\Geodistance;
// Rotterdam
$lat1 = 51.924419;
$lon1 = 4.47917;
// Amsterdam
$lat2 = 52.370216;
$lon2 = 4.477733;
Miles
Geodistance::distance($lat1, $lon1, $lat2, $lon2, 'M'); // 30.800174981173
Kilometers
Geodistance::distance($lat1, $lon1, $lat2, $lon2, 'K'); // 49.568076804901
Nautical Miles
Geodistance::distance($lat1, $lon1, $lat2, $lon2, 'N'); // 26.746871953651