PHP Class Transport\Entity\Coordinate

显示文件 Open project: opendatach/transport Class Usage Examples

Public Properties

Property Type Description
$type string The type of the given coordinate.
$x float Latitude.
$y float Longitude.

Public Methods

Method Description
createFromJson ( $json )
createFromXml ( SimpleXMLElement $xml ) : Coordinate Factory method to create an instance of Coordinate and extract the data from the given xml.
floatToInt ( $float )
getDistanceTo ( $lat, $lon ) : float Calculates the distance to another coordinate using the Haversine Formula.
intToFloat ( $int )
setHAFAScoordinates ( $coordinate, $x, $y )

Method Details

createFromJson() public static method

public static createFromJson ( $json )

createFromXml() public static method

Factory method to create an instance of Coordinate and extract the data from the given xml.
public static createFromXml ( SimpleXMLElement $xml ) : Coordinate
$xml SimpleXMLElement The item xml
return Coordinate The created instance

floatToInt() public static method

public static floatToInt ( $float )

getDistanceTo() public method

Not really accurate.
public getDistanceTo ( $lat, $lon ) : float
return float

intToFloat() public static method

public static intToFloat ( $int )

setHAFAScoordinates() public static method

public static setHAFAScoordinates ( $coordinate, $x, $y )

Property Details

$type public_oe property

The type of the given coordinate.
public string $type
return string

$x public_oe property

Latitude.
public float $x
return float

$y public_oe property

Longitude.
public float $y
return float