MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / toLatLng

Function toLatLng

libs/leaflet/leaflet-src.js:1555–1578  ·  view source on GitHub ↗
(a, b, c)

Source from the content-addressed store, hash-verified

1553 // Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead.
1554
1555 function toLatLng(a, b, c) {
1556 if (a instanceof LatLng) {
1557 return a;
1558 }
1559 if (isArray(a) && typeof a[0] !== 'object') {
1560 if (a.length === 3) {
1561 return new LatLng(a[0], a[1], a[2]);
1562 }
1563 if (a.length === 2) {
1564 return new LatLng(a[0], a[1]);
1565 }
1566 return null;
1567 }
1568 if (a === undefined || a === null) {
1569 return a;
1570 }
1571 if (typeof a === 'object' && 'lat' in a) {
1572 return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);
1573 }
1574 if (b === undefined) {
1575 return null;
1576 }
1577 return new LatLng(a, b, c);
1578 }
1579
1580 /*
1581 * @namespace CRS

Callers 5

leaflet-src.jsFile · 0.70
polygonCenterFunction · 0.70
centroidFunction · 0.70
polylineCenterFunction · 0.70
latLngToCoordsFunction · 0.70

Calls 1

isArrayFunction · 0.50

Tested by

no test coverage detected