PHP code example of maris / geo-haversine-calculator
1. Go to this page and download the library: Download maris/geo-haversine-calculator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
maris / geo-haversine-calculator example snippets
$ellipsoid = new class () implements \Maris\Interfaces\Geo\Model\EllipsoidInterface
{
//// Реализовать эллипсоид.
public function getArithmeticMeanRadius() : float
{
return 6371008.8;
}
};
$calculator = new \Maris\Geo\Haversine\HaversineCalculator( $ellipsoid );
$point1 = new class implements \Maris\Interfaces\Geo\Aggregate\LocationAggregateInterface{};
$point2 = new class implements \Maris\Interfaces\Geo\Aggregate\LocationAggregateInterface{};
$distance = $calculator->calculateDistance( $point1, $point2 );
var_dump($distance); // float растояние между точками.