ym.modules.provider.LatLng
Overview
Represents a geographical point with a specific latitude and longitude.
var latlng = ym.latLng(50.5, 30.5);
All leaflet methods that accept LatLng
objects also accept them in simple array and object form (unless otherwise specified). These lines are equivalent:
map.panTo([50, 30]);
map.panTo({lon: 30, lat: 50});
map.panTo({lat: 50, lng: 30});
map.panTo(ym.latLng(50, 30));
Initialization
Factory: ym.latLng(latitude, longitude, altitude)
Creates an object that represents a geographic point with the specified latitude and longitude (and optionally altitude).
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
latitude |
Latitude [required] |
double |
|
longitude |
Longitude [required] |
double |
|
altitude |
Altitude [optional] |
double |
Constants
Name | Description | Data type | Default value |
---|---|---|---|
DEG_TO_RAD |
A multiplier for the conversion from degrees to radians. | double |
Math.PI /180 |
RAD_TO_DEG |
A multiplier for the conversion from radians to degrees. | double |
180 / Math.PI |
MAX_MARGIN |
Maximum error limit for the equality check. | double |
1.0E-9 |
Methoden
distanceTo(otherLatlng) ab v3
Returns the distance (in meters) to the specified LatLng
. Calculated with the Haversine formula. See Description on Wikipedia.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
otherLatlng |
LatLng |
Return
int
equals(otherLatlng) ab v3
Returns true if the specified LatLng
point is at the same position (within a small error limit)
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
otherLatlng |
LatLng |
Return
bool
toString() ab v3
Returns a string representation of the dot (for debugging purposes)
Return
string
wrap(left, right) ab v3
Returns a new LatLng
object whose longitude is wrapped around the left and right boundaries (-180 to 180 by default).
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
left |
double |
||
right |
double |
Return
LatLng