当我使用SHTML时,以下代码成功将shapefile加载到传单中,但是如果使用HTML(必须使用),则失败。它不返回任何错误,shapefile对象初始化,但未显示形状。 知道如何处理吗?我如何找出正在发生的事情?
// so far so good
var m = L.map('map').setView([47.5757798, 13.656677], 7);
var watercolor = L.tileLayer('http://maps.wien.gv.at/basemap/bmapgrau/normal/google3857/{z}/{y}/{x}.png', {
attribution: 'TEST'
}).addTo(m);
// here the problem begins
var shpfile = new L.Shapefile('/shapes/Layer_A.zip', {
style: function(feature1) {
return {
color:"#ff0000",
fillColor:"#ff0000",
fillOpacity:.50
};
}
});
shpfile.addTo(m);
// it never gets this far, the console does not show the message
shpfile.once("data:loaded", function() {
console.log("finished loaded shapefile");
});