问题在于在此修改后的框架中添加了线串/折线。
例如,我无法使用以下格式通过线串GeoJSON数据添加新的地图图层:
L.map('map').
我可以使该线串与leafllet.js一起使用:
...但这使用了“ L”。 来自leaflet.js,并且在修改后的MapBox模板中不起作用。
L.geoJson(myLine1, {style: myStyle}).addTo(map);
问题是,MapBox修改后的商店定位器应用似乎没有实现相同的界面。
这是我当前的代码,试图添加具有线串的图层:
foursquare.lines = function() {
var lines = { 'type': 'FeatureCollection',
'features': []
};
lines.features.push({
type: 'Feature',
// id: venue.id,
geometry: {
type: 'LineString',
coordinates: [[
60.317769,
24.929009
],
[
24.9292486208828,
60.1681323558666
],
[
24.951764345169067,
60.168932342858554
],
[
24.93321418762207,
60.16911913731421
],
[
24.952929,
60.167312
],
[
24.944114685058594,
60.170111798603266
],
[
24.94499444961548,
60.171435300334004
]]
},
properties: {}
}); //push
//console.log(lines);
if (MM_map.lineLayer) {
MM_map.lineLayer.geojson(lines);
alert("hi");
} else {
MM_map.lineLayer = mmg().geojson(lines);
//alert("hello");
console.log(lines);
}
MM_map.addLayer(MM_map.lineLayer);
}; //foursquare.lines
图层被添加为空div,但是geojson和lines对象未得到处理且未显示。
当我运行console.log(lines)时,我正确地获取了所有geojson数据,只是没有使用此行添加它:
mmg().geojson(lines)
我真的很感谢这方面的帮助。 谢谢