posted on Fri, Nov 23 '18 under tag: code

Leaflet and geojson might sometimes have issues because of a standards confusion. This is how to fix it

You might end up with geojson that has latitude and longitude in different order than what leaflet.js expects. If that is the case, here is what you need:

L.geoJSON(json, {
    coordsToLatLng: function(coords) {
        return new L.LatLng(coords[0], coords[1], coords[2]);


Like what you are reading? Subscribe (by RSS, email, twitter, or telegram)!