mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-16 16:45:22 +00:00
Allow raw latlng array in latLngToCoords/latLngsToCoords (#7436)
* Add Array traitment into latLngToCoords/latLngsToCoords add array management into function latLngToCoords and coordsToLatLngs Add array management into GeoJSON.latLngToCoords andGeoJSON.latLngToCoords * Add tests * minify code * remove redundant code * revert change Co-authored-by: Dorian Benedetti <dorian.benedetti@etu.u-bordeaux.fr> Co-authored-by: Florian Bischof <design.falke@gmail.com>
This commit is contained in:
@ -8,6 +8,7 @@ import {Polyline} from './vector/Polyline';
|
||||
import {Polygon} from './vector/Polygon';
|
||||
import {LatLng} from '../geo/LatLng';
|
||||
import * as LineUtil from '../geometry/LineUtil';
|
||||
import {toLatLng} from '../geo/LatLng';
|
||||
|
||||
|
||||
/*
|
||||
@ -257,6 +258,7 @@ export function coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) {
|
||||
// Reverse of [`coordsToLatLng`](#geojson-coordstolatlng)
|
||||
// Coordinates values are rounded with [`formatNum`](#util-formatnum) function.
|
||||
export function latLngToCoords(latlng, precision) {
|
||||
latlng = toLatLng(latlng);
|
||||
return latlng.alt !== undefined ?
|
||||
[Util.formatNum(latlng.lng, precision), Util.formatNum(latlng.lat, precision), Util.formatNum(latlng.alt, precision)] :
|
||||
[Util.formatNum(latlng.lng, precision), Util.formatNum(latlng.lat, precision)];
|
||||
|
Reference in New Issue
Block a user