Skip to content

Document which coordinate system is used by ipyleaflet and leaflet #280

Open
@SylvainCorlay

Description

@SylvainCorlay

It should probably be specified in the documentation that leaflet uses EPSG:4326 all L.LatLngs object. For display, EPSG:3857 is used instead.

Now quoting the stack-overflow answer https://gis.stackexchange.com/questions/54065/leaflet-geojson-coordinate-problem about "coordinates" vs "latitute-longitude"

When dealing with Cartesian coordinate geometry, we generally use X-Y. Many GIS systems, work with a Geographic Location as a special case of a 2 D coordinate point, where the X represents the longitude and Y represents the Latitude. This order of coordinates, is exactly opposite that of the regular Lat-long notion which has been codified in the ISO 6709 standard.

  • The map.setView takes a l.LatLong as an input, where the first cordinate is a Latitude, and the second is Longitude. Hence when you want 52.23N, 4.97E, you pass in [52.23943, 4.97599]

  • The GeoJSON standard says that for any point, the first parameter is the X Coordinate (i.e. Longitude) and second parameter is the Y coordinate (i.e. Latitude); Hence when you want 52.23N, 4.97E in GeoJSON, you need to pass [4.97599, 52.23943].

Note: the leafletjs library appears to have a L.GeoJSON.coordsToLatLng() function that may be useful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions