distanceFrom() public method

Calculates the distance between two Coordinate objects
public distanceFrom ( Coordinate $coordinate, ValueObjects\Geography\DistanceUnit $unit = null, ValueObjects\Geography\DistanceFormula $formula = null ) : ValueObjects\Number\Real
$coordinate Coordinate
$unit ValueObjects\Geography\DistanceUnit
$formula ValueObjects\Geography\DistanceFormula
return ValueObjects\Number\Real
示例#1
0
 public function testDistanceFrom()
 {
     $newYork = new Coordinate(new Latitude(41.145556), new Longitude(-73.995));
     $distance = $this->coordinate->distanceFrom($newYork);
     $this->assertSame(7609068.4225575, $distance->toNative());
 }