【问题标题】:openlayers strategy: ol.loadingstrategy.bbox does'nt work with wfs featuresopenlayers 策略:ol.loadingstrategy.bbox 不适用于 wfs 功能
【发布时间】:2017-12-04 21:57:20
【问题描述】:

我尝试使用此代码在 wfs 中使用 openlayers 4(最多 1000 个)可视化包裹。 但是视图地图的每次移动或缩放时范围都不会改变,或者新功能不会加载到图层中?

 var parcellaireSource =  new ol.source.Vector({ 
    format: new ol.format.GeoJSON(),
    url: function (extent) {
      return  'https://wxs.ign.fr/api key/geoportail/wfs?request=GetCapabilities&SERVICE=WFS&VERSION=2.0.0&request=GetFeature&typename=BDPARCELLAIRE-VECTEUR_WLD_BDD_WGS84G:parcelle&outputFormat=application/json&srsname=EPSG:2154&bbox='+ extent.join(',') + ',EPSG:3857';

          },

    strategy: ol.loadingstrategy.bbox
    });
     var parcellairewfs =  new ol.layer.Vector({
    source: parcellaireSource
  });
     map.addLayer(parcellairewfs);

【问题讨论】:

  • 它知道什么时候我广告功能 onMoveEnd(evt) { parcellaireSource.clear() console.log(view.getResolution()); console.log(parcellaireSource); } map.on('moveend', onMoveEnd);但是,由于功能数量的限制,我只想在某个缩放级别上加载它们。你知道怎么做吗?

标签: openlayers


【解决方案1】:

当我添加时它会起作用

function onMoveEnd(evt) { parcellaireSource.clear() } map.on('moveend', onMoveEnd);

但是,由于功能数量的限制,我只想在某个缩放级别上加载它们。你知道怎么做吗?

【讨论】:

    【解决方案2】:

    完成了

      url: function (extent,resolution) {if (resolution<1) {return ....
    

    在vectorsource计算中并在函数中添加分辨率参数

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-10
      • 2017-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多