I am trying to use GEOJSON along with leaflet and am attempting to display a linestring between two locations , by dynamically entering their coordinates in the geoJSON feature
var geojsonFeature = { "type": "Feature",
"properties": {
"name": "Coors Field",
"amenity": "Baseball Stadium",
"popupContent": "This is where the Rockies play!"
},
"geometry": {
"type": "LineString",
"coordinates": [[77.68148,12.91127],[77.60943,12.91125]]
}
};
L.geoJson(geojsonFeature).addTo(map);
Is there any way by which i could enter coordinates in the geoJsonfeature dynamically using a loop , if so what would be the syntax to form the coordinates array this way ?
Thanks.