LatLng Class¶
- class BeastBytes\Yii\Leaflet\Types\LatLng¶
Represents a geographical location at a given latitude and longitude, optionally with an altitude
Latitude is checked to ensure it is in range -90 <= latitude <= 90
Note
Longitude is not checked as an out of bounds longitude is necessary if a
LatLngBoundsspans the antemeridian- __construct(array|float $latitude, ?float $longitude = null, ?float $altitude = null, bool $checkLng = true)¶
Create a new LatLng instance
Latitude and longitude are given in degrees decimal, altitude is given in metres
- Parameters:
$latitude (
array{float, float}|array{float, float, float}|array{lat: float, lng: float}|array{lat: float, lng: float, alt: float}|float) –float - Latitude
array{float, float}|array{lat: float, lng: float} - Latitude and Longitude
array{float, float, float}|array{lat: float, lng: float, alt: float} - Latitude, Longitude, and Altitude
$longitude (
?float) – Longitude (ignored if $latitude is an array)$altitude (
?float) – Altitude (ignored if $latitude is an array)
- Returns:
A new LatLng instance
- Return type:
- Throws:
InvalidArgumentException if $latitude out of bounds
See also