Skip to content

GeoJSON's latLngToCoords/latLngsToCoords do not accept Array form of LatLngΒ #7425

Closed
@johnd0e

Description

https://leafletjs.com/reference-1.7.1.html#latlng

All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise)

But L.GeoJSON.latLngToCoords/latLngsToCoords do not accept Array form:

// @function latLngToCoords(latlng: LatLng, precision?: Number): Array
// Reverse of [`coordsToLatLng`](#geojson-coordstolatlng)
export function latLngToCoords(latlng, precision) {
precision = typeof precision === 'number' ? precision : 6;
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)];
}

That should be documented.
Or fixed (not sure whether it would be really useful).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions