This repository has been archived on 2024-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
pflaenz.li-Symfony/src/Service/DistanceCalculator.php

20 lines
403 B
PHP
Raw Normal View History

<?php
namespace App\Service;
use Location\Coordinate;
use Location\Distance\Vincenty;
class DistanceCalculator
{
public function calculateDistance(Coordinate $coordinate1, Coordinate $coordinate2)
{
$calculator = new Vincenty();
$distance = $calculator->getDistance($coordinate1, $coordinate2);
$distance = round($distance / 1000);
return $distance;
}
}