I'm having a problem with visualizing a WFS layer in Openlayers. I can see I get the response, but nothing shows up on my map. I tried more potential solutions from stackexchange, but couldn't get it working. The WFS layers are shown correctly in QGIS without any special configuration.
The address of the WFS in question is: http://eagri.cz/public/app/wms/plpis_wfs.fcgi
- open data for the Czech Republic.
My code (basic version, I tried more solutions which didn't work):
var vectorSource = new ol.source.Vector({
format: new ol.format.WFS(),
url: function (extent) {
return (
'http://eagri.cz/public/app/wms/plpis_wfs.fcgi?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=LPIS_DPB_UCINNE&SRSNAME=EPSG:102067&' +
'bbox=' +
extent.join(',') +
',EPSG:3857'
);
},
strategy: ol.loadingstrategy.bbox
});
var vector = new ol.layer.Vector({
source: vectorSource,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#FF0000',
width: 2
}),
projection: new ol.proj.Projection('EPSG:102067')
}),
});
var map = new ol.Map({
target: 'map',
pixelRatio: 1,
layers: [
vector
],
view: new ol.View({
center: ol.proj.fromLonLat(cw_global_initCoordinates),
zoom: 15
})
});
Generated request example: http://eagri.cz/public/app/wms/plpis_wfs.fcgi?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=LPIS_DPB_UCINNE&SRSNAME=EPSG:102067&bbox=1885304.656759394,6323618.39452889,1892413.3003899155,6326422.678004101,EPSG:3857 - follow the request link to get the example response