我正在尝试使用GEOJSON和传单,并尝试在两个位置之间显示一个线串,方法是在geoJSON功能中动态输入它们的坐标
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);
有没有什么方法可以使用循环动态输入geoJsonfeature中的坐标,如果是这样的话,这样形成坐标数组的语法是什么?
感谢。
答案 0 :(得分:0)
为什么不写:
geojsonFeature.geometry.coordinates = whaterveryouwant;
或者我错过了什么?