本文介绍了openlayers策略:ol.loadingstrategy.bbox不适用于wfs功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用此代码在带有openlayers 4(最大1000)的wfs中可视化包裹.但是范围不会随视图地图的每次移动或缩放而变化,还是新的要素不会加载到图层中?

I tried to visualize parcels in wfs with openlayers 4 (max 1000) with this code.But the extent does not change at each movement or zoom of the view map, or the new features do not load in the layer?

 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);

推荐答案

通过

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

在向量源计算中,并在函数中添加分辨率参数

in the vectorsource calculation and adding resolution parameter to the function

这篇关于openlayers策略:ol.loadingstrategy.bbox不适用于wfs功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 13:12