0
我已经把我的vectorSource这样的:打开图层3创建进度条装载机loadingstrategy.bbox
var vectorSource = function (date) {
return new ol.source.Vector({
// Start loader
loader: function (extent, resolution, projection) {
var url = 'urlpath?date=' + date;
// Show progress bar
$('#progress').fadeIn();
$.ajax({
url: url,
success: function (data) {
var format = new ol.format.GeoJSON();
var features = format.readFeatures(data, function() {
featureProjection: 'EPSG:3857'
});
var source = vectorSource();
// Add the features not printing on the map but the data is there
source.addFeatures(features);
// When source is ready, then finish
if (source.getState() == 'ready') {
setTimeout(function() {
// Hide progress bar
$('#progress').fadeOut(750);
}, 1000)
}
}
});
},
strategy: ol.loadingstrategy.all,
});
}
我可以读取功能,但我不能把它们打印成图。我试图看看它是投影问题还是尝试再次渲染地图,但不知道这个答案。
谢谢@pavlos。这是在用户等待加载所有功能时使用加载程序的最佳方法吗?理想情况下,地图baseLayer会立即加载,然后加载器隐藏一次所有的功能加载 –
Hi @pavlos。由于我努力将特征打印到地图中,因此我编辑了原始问题。 –