我试图在传单中插入标记之间的行(从JSON数据生成).我看到了一个示例,但它不适用于JSON数据.我可以看到标记,但没有出现任何线条.
var style = {
color: 'red',
fillColor: "#ff7800",
opacity: 1.0,
fillOpacity: 0.8,
weight: 2
};
$.getJSON('./server?id_dispositivo=' + id_device + '', function(data) {
window.geojson = L.geoJson(data, {
onEachFeature: function (feature, layer) {
var Icon = L.icon({
iconUrl: './images/mymarker.png',
iconSize: [18, 28], // size of the icon
style: style,
});
layer.setIcon(Icon);
layer.bindPopup(feature.properties.date + '<br />' + feature.properties.id);
}
});
});
map.addLayer(geojson);
Run Code Online (Sandbox Code Playgroud)
我的JSON数据:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-70.219841,
8.6310997
]
},
"properties": …Run Code Online (Sandbox Code Playgroud)