Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Openlayers 5 将WFS集成为OL5中的gml_Openlayers 5 - Fatal编程技术网

Openlayers 5 将WFS集成为OL5中的gml

Openlayers 5 将WFS集成为OL5中的gml,openlayers-5,Openlayers 5,我尝试在OL5中可视化WFS(来自MapServer) WFS运行良好(我可以在QGIS中毫无问题地实现它)。 还有一个请求,如: 给我一个很好的gml输出,epsg:25832 我尝试在OpenLayers中实现它,比如: var vectorSource = new VectorSource({ format: new WFS(), loader: function(extent, resolution, projection) { var

我尝试在OL5中可视化WFS(来自MapServer)

WFS运行良好(我可以在QGIS中毫无问题地实现它)。 还有一个请求,如:

给我一个很好的gml输出,epsg:25832

我尝试在OpenLayers中实现它,比如:

var vectorSource = new VectorSource({
        format: new WFS(), 
        loader: function(extent, resolution, projection) {
        var url = 'http://blablabla/mapserv?service=WFS&version=1.1.0&request=GetFeature&typename=ms:Flurstueckepunkt&srsname=EPSG:25832&bbox=412200,5791337,413600,5791800,EPSG:25832'
          fetch(url).then(function(response) {
            return response.text();
          }).then(function(text) {
            var features = vectorSource.getFormat().readFeatures(text);

            // Add parsed features to vectorSource
            vectorSource.addFeatures(features);
          }).catch(function(error) {
            alert(error.message);
          })
        }
      });

    var WFSLayer =new VectorLayer(
    {   
        source: vectorSource,
               projection: 'EPSG:25832',
        style: new Style({     fill: new Fill({ color: 'yellow'  })
    })
      });


      var view = new View({
           center: [rechtswert,hochwert],
        zoom: mzoom,
        projection: 'EPSG:25832'
      });
      var map = new Map({

        layers: [osm,wmsLayer2,WFSLayer],
        target: 'map',
        view: view
      });
…但WFS层根本没有显示

通过Mozille调试器,我可以看到wfs请求可以正常工作,但什么都看不见?
有人知道这里出了什么问题吗?

好的,我知道了。作为WFS ist交付点,可视化风格非常重要

它现在可用于:

var vectorSource = new Vector({
  format: new GML3(),
  loader: function(extent) {
  var url = 'http://blablalbvlAn/cgi-bin/mapserv?service=WFS&version=1.1.0&request=GetFeature&typename=ms:Flurstueckepunkt&srsname=EPSG:25832&' +
  'bbox='+ extent.join(',') +',EPSG:25832';

     var xhr = new XMLHttpRequest();
     xhr.open('GET', url);
     var onError = function() {
       vectorSource.removeLoadedExtent(extent);
     }
     xhr.onerror = onError;
     xhr.onload = function() {
       if (xhr.status == 200) {
         vectorSource.addFeatures(
             vectorSource.getFormat().readFeatures(xhr.responseText));
                var features3 = vectorSource.getFeatures();
       } else {
         onError();
       }
     }
     xhr.send();
   },
   strategy: bbox
 });




    var WFSLayer =new VectorLayer(
    {   
        source: vectorSource,
        style:  new Style({
    image: new CircleStyle({
      radius: 5,
      fill: new Fill({
        color: 'orange'
      })
    })
      })
      });