piorkoo
piorkoo

Reputation: 63

Openlayers WFS how to find all necessary parameters

I would like to add WFS to my map. I know the example on openlayers.org but I have problem with my custom url

     const vectorSource = new VectorSource({
  format: new GeoJSON(),
  url: function (extent) {
    return (
      'https://mapy.geoportal.gov.pl/wss/service/PZGIK/DanePomiaroweLidarKRON86/WFS/Skorowidze?SERVICE=WFS&REQUEST=GetFeatures&typename=gugik:SkorowidzeDanychPomiarowychLIDAR2022&outputFormat=application/gml+xml&srsname=EPSG:3857&bbox=' +
      extent.join(',') +
      ',EPSG:3857'
      );
    },
    
  strategy: bboxStrategy,

});

The problem how to identify all the parameters such: typename, output Format, EPSG ect from only url?

https://mapy.geoportal.gov.pl/wss/service/PZGIK/DanePomiaroweLidarEVRF2007/WFS/Skorowidze?SERVICE=WFS&REQUEST=GetCapabilities

Can someone help me to prepare correct url for openlayers?

Upvotes: 0

Views: 182

Answers (1)

Mike
Mike

Reputation: 17872

The format must be WFS as the service does not support application/json output. request should be GetFeature (not GetFeatures). version is also required (1.1.0 is the WFS format default).

This works for me but the service does not support CORS so a proxy or browser override will be needed https://codesandbox.io/s/vector-wfs-forked-hgwkvv?file=/main.js

const vectorSource = new VectorSource({
  format: new WFS(),
  url: function (extent) {
    return (
      'https://mapy.geoportal.gov.pl/wss/service/PZGIK/DanePomiaroweLidarEVRF2007/WFS/Skorowidze?SERVICE=WFS&' +
      'version=1.1.0&request=GetFeature&typename=gugik:SkorowidzDanychPomiarowychLIDAR2022&' +
      'srsname=EPSG:3857&' +
      'bbox=' +
      extent.join(',') +
      ',EPSG:3857'
    );
  },
  strategy: bboxStrategy,
});

Upvotes: 0

Related Questions