I am trying to display a geometry trough a WFS in OpenLayer 4. The problem is that using the following snippet of code.. The request is succesfull, I can see the XML (wfs gml) data in the response (using firebug) but the polygons are not visible. It seems that the readFeatures method cannot parse the XML (gml) file. Is there any way of specifying the xml (gml) element in the readFeatures method in order to read the geometry?
...
...
var vectorSource = new ol.source.Vector({
format: new ol.format.WFS({
featureNS: 'http://www.opengis.net/wfs/2.0',
featureType: 'Test'
}),
loader: function(extent, resolution, projection) {
var url = 'http://localhost/deegree-webservices-3.3.20/services/test_WFS?'+
'service=WFS&request=GetFeature&'+
'version=2.0.0&typeNames=aaa:Testg&count=30&'+
'srsname=EPSG:3857';
$.ajax({
url: url
})
.done(function(response) {
vectorSource.addFeatures((new ol.format.WFS()).readFeatures(response));
});
},
projection: 'EPSG:3857'
});
...
...