Skip to content

davidvandertuijn/geodistance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Geo Distance

Total Downloads Latest Stable Version License

Geo Distance

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.

"Buy Me A Coffee"

Install

composer require davidvandertuijn/geodistance

Usage

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