PHP Class Location\Coordinate

Author: Marcus Jaschen ([email protected])
Inheritance: implements location\GeometryInterface
Datei anzeigen Open project: mjaschen/phpgeo Class Usage Examples

Protected Properties

Property Type Description
$ellipsoid Ellipsoid
$lat float
$lng float

Public Methods

Method Description
__construct ( float $lat, float $lng, Ellipsoid $ellipsoid = null )
format ( Location\Formatter\Coordinate\FormatterInterface $formatter ) : mixed
getDistance ( Coordinate $coordinate, Location\Distance\DistanceInterface $calculator ) : float Calculates the distance between the given coordinate and this coordinate.
getEllipsoid ( ) : Ellipsoid
getLat ( ) : float
getLng ( ) : float
getPoints ( ) : array Returns an array containing the point

Protected Methods

Method Description
isNumericInBounds ( float $value, float $lower, float $upper ) : boolean Checks if the given value is (1) numeric, and (2) between lower and upper bounds (including the bounds values).
isValidLatitude ( mixed $latitude ) : boolean Validates latitude
isValidLongitude ( mixed $longitude ) : boolean Validates longitude

Method Details

__construct() public method

public __construct ( float $lat, float $lng, Ellipsoid $ellipsoid = null )
$lat float -90.0 .. +90.0
$lng float -180.0 .. +180.0
$ellipsoid Ellipsoid if omitted, WGS-84 is used

format() public method

public format ( Location\Formatter\Coordinate\FormatterInterface $formatter ) : mixed
$formatter Location\Formatter\Coordinate\FormatterInterface
return mixed

getDistance() public method

Calculates the distance between the given coordinate and this coordinate.
public getDistance ( Coordinate $coordinate, Location\Distance\DistanceInterface $calculator ) : float
$coordinate Coordinate
$calculator Location\Distance\DistanceInterface instance of distance calculation class
return float

getEllipsoid() public method

public getEllipsoid ( ) : Ellipsoid
return Ellipsoid

getLat() public method

public getLat ( ) : float
return float

getLng() public method

public getLng ( ) : float
return float

getPoints() public method

Returns an array containing the point
public getPoints ( ) : array
return array

isNumericInBounds() protected method

Checks if the given value is (1) numeric, and (2) between lower and upper bounds (including the bounds values).
protected isNumericInBounds ( float $value, float $lower, float $upper ) : boolean
$value float
$lower float
$upper float
return boolean

isValidLatitude() protected method

Validates latitude
protected isValidLatitude ( mixed $latitude ) : boolean
$latitude mixed
return boolean

isValidLongitude() protected method

Validates longitude
protected isValidLongitude ( mixed $longitude ) : boolean
$longitude mixed
return boolean

Property Details

$ellipsoid protected_oe property

protected Ellipsoid,location $ellipsoid
return Ellipsoid

$lat protected_oe property

protected float $lat
return float

$lng protected_oe property

protected float $lng
return float