0
我有折線列表。我想讓它更有條理。我怎樣才能讓我的折線列表進入GeoJSON?leafletjs:折線列表到geojson
var point1 = new coordsToLatLngArray(0, 100);
var point2 = new coordsToLatLngArray(200, 150);
var point3 = new coordsToLatLngArray(400, 70);
var point4 = new coordsToLatLngArray(10, 70);
var point5 = new coordsToLatLngArray(90, 50);
var pointList = [point1, point2, point3, point4, point5];
var firstpolyline = new L.polyline(pointList, {
color: 'red',
weight: 3,
opacity: 0.5,
smoothFactor: 1
});
firstpolyline.addTo(map);
我已經試圖與合作:http://leafletjs.com/examples/geojson.html ,但沒有奏效。我行是地圖外:
var geojsonFeature = [{
"type": "LineString",
"coordinates":
[
[0,0],
[-100,100]
]
}];
var myStyle = {
"color": "#ff7800",
"weight": 5,
"opacity": 0.65
};
var myLayer = L.geoJson(coordsToLatLngArray(), {style: myStyle }).addTo(l);
myLayer.addData(geojsonFeature);
問題的演示: http://jsfiddle.net/n4k1psuh/
非常感謝你,拯救生命! – 2015-02-08 21:41:03