davidvandertuijn/geodistance

2.0.0 2024-10-02 14:45 UTC

This package is auto-updated.

Last update: 2024-12-02 15:15:00 UTC


README

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