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
Source:stackexchange.com