[Django]-Django data render to JavaScript to make a map polyline with latitude and longitude

3👍

Use this code. I have created an empty array and push the dynamic data to that array and used to your location . Just copy the code and paste it.

    var polyArr = [];
    myData.map((item) => polyArr.push([item.fields.latitude, item.fields.longitude]));
    L.polyline(polyArr, { color: 'red' }).addTo(mymap).bindPopup('I am a polygon.');

If you are not clear ask me. Hope this helps you. Thank you

👤Hasib

Leave a comment