PHP Class League\Geotools\Distance\Distance

Author: Antoine Corcy ([email protected])
Inheritance: extends League\Geotools\AbstractGeotools, implements League\Geotools\Distance\DistanceInterface
Mostra file Open project: toin0u/geotools Class Usage Examples

Protected Properties

Property Type Description
$unit string The user unit.

Public Methods

Method Description
flat ( ) : double Returns the approximate flat distance between two coordinates using Pythagoras’ theorem which is not very accurate.
getFrom ( ) {@inheritDoc}
getTo ( ) {@inheritDoc}
greatCircle ( ) : double Returns the approximate distance between two coordinates using the spherical trigonometry called Great Circle Distance.
haversine ( ) : double Returns the approximate sea level great circle (Earth) distance between two coordinates using the Haversine formula which is accurate to around 0.3%.
in ( $unit ) {@inheritDoc}
setFrom ( League\Geotools\Coordinate\CoordinateInterface $from ) {@inheritDoc}
setTo ( League\Geotools\Coordinate\CoordinateInterface $to ) {@inheritDoc}
vincenty ( ) : double Returns geodetic distance between between two coordinates using Vincenty inverse formula for ellipsoids which is accurate to within 0.5mm.

Protected Methods

Method Description
convertToUserUnit ( double $meters ) : double Converts results in meters to user's unit (if any).

Method Details

convertToUserUnit() protected method

The default returned value is in meters.
protected convertToUserUnit ( double $meters ) : double
$meters double
return double

flat() public method

Returns the approximate flat distance between two coordinates using Pythagoras’ theorem which is not very accurate.
See also: http://en.wikipedia.org/wiki/Pythagorean_theorem
See also: http://en.wikipedia.org/wiki/Equirectangular_projection
public flat ( ) : double
return double The distance in meters

getFrom() public method

{@inheritDoc}
public getFrom ( )

getTo() public method

{@inheritDoc}
public getTo ( )

greatCircle() public method

Returns the approximate distance between two coordinates using the spherical trigonometry called Great Circle Distance.
See also: http://www.ga.gov.au/earth-monitoring/geodesy/geodetic-techniques/distance-calculation-algorithms.html#circle
See also: http://en.wikipedia.org/wiki/Cosine_law
public greatCircle ( ) : double
return double The distance in meters

haversine() public method

Returns the approximate sea level great circle (Earth) distance between two coordinates using the Haversine formula which is accurate to around 0.3%.
See also: http://www.movable-type.co.uk/scripts/latlong.html
public haversine ( ) : double
return double The distance in meters

in() public method

{@inheritDoc}
public in ( $unit )

setFrom() public method

{@inheritDoc}
public setFrom ( League\Geotools\Coordinate\CoordinateInterface $from )
$from League\Geotools\Coordinate\CoordinateInterface

setTo() public method

{@inheritDoc}
public setTo ( League\Geotools\Coordinate\CoordinateInterface $to )
$to League\Geotools\Coordinate\CoordinateInterface

vincenty() public method

Returns geodetic distance between between two coordinates using Vincenty inverse formula for ellipsoids which is accurate to within 0.5mm.
See also: http://www.movable-type.co.uk/scripts/latlong-vincenty.html
public vincenty ( ) : double
return double The distance in meters

Property Details

$unit protected_oe property

The user unit.
protected string $unit
return string