I can't solve the display of my WFS. I can see the request returning the data in my debugger, but it is not showing. My reference for solving this problem was Openlayers3 using custom EPSG:25832.
Am I right, suspecting that I do not need to further transform my vectorLayer? Is my center causing the problem, because I transform to 'EPSG:3857' rather then 'EPSG:25832' (again I would suspect not - since it is just the center)?
let myProjectionName = 'EPSG:25832';
proj4.defs(myProjectionName, '+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs');
let myProjection = ol.proj.get(myProjectionName);
this.mapView = new ol.View({
center: ol.proj.transform([9.98, 53.55], 'EPSG:4326', 'EPSG:3857'),
zoom: 9,
projection: myProjection
});
let vectorLayer = new ol.source.Vector({
format: new ol.format.GML(),
url: function(extent) {
return 'https://geodienste.hamburg.de/HH_WFS_Statistik_Stadtteile_Wahlergebnisse' +
'?version=1.1.0&request=GetFeature&typename=Statistik_Stadtteile_Wahlergebnisse:Buergerschaftswahl_15.02.2015_-_Wahlbeteiligung_in_Prozent' +
'&bbox' + extent.join(',') + ',EPSG:25832';
},
strategy: ol.loadingstrategy.bbox,
projection: 'EPSG:25832'
});
this.map = new ol.Map({
target: this.mapId2,
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
new ol.layer.Vector({
source: vectorLayer
})
],
view: this.mapView
});