Search code examples
javascriptgeojson

Changing the order of long lat from geojson file in js


I'm trying to get points out of a geojson file but the coordinate of the points are in the opposite way instead of (x,y) as opposed to (y,x).

On the map I am getting a place that is not really on the map.

How can i get it right in javascript?

This is my code that takes out the points and binds a popup for each point on a map:

jQuery.getJSON("data/london_pois.geojson",function(data){
    // add GeoJSON layer to the map once the file is loaded
    L.geoJson(data,{
        onEachFeature: function (feature, layer) {
            layer.bindPopup(feature.properties.name);
        }
    }).addTo(map);
});

Solution

  • I realized that my issue was not a programming issue, but rather the data set was too large.

    After removing a some entries, everything worked fine.