1

This question already has an answer here:

I am trying to add polyline in my existing leaflet map. But unfortunately its not overlapping the correct coordinates.

enter image description here

this.testd = [
            [26.946345158021394, 45.30658810117468], [31.74737690870502, 58.27657611253403], [3.572373155835759, 50.87794848675696]
        ]

        this.pathLine = L.polyline(this.testd);
        this.allLayers.addLayer(this.pathLine);
        this.allLayers.addTo(this.map);

Please let me know how to make it work.

marked as duplicate by IvanSanchez, LaughU, Ian Turton Jul 30 at 9:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Correct order of coordinates when specifying geographical points in Leaflet is [latitude, longitude], so you have to reverse your coordinates in this.testd array.

  • Yeah i got that. Such a silly mistake. Now i am using : L.GeoJSON.coordsToLatLngs(filteredFeatureDataCoordinates); to swap and solve. – TrickOrTreat Jul 30 at 8:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.