1

This question is an exact duplicate of:

I can't get this WFS to work. I tried to stick to the OL-WFS examples - no luck.

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;
  },
  strategy: ol.loadingstrategy.bbox
});

this.featureLayer = vectorLayer;

return new ol.layer.Vector({
  source: vectorLayer,
  style: new ol.style.Style({
    stroke: new ol.style.Stroke({
      color: 'rgba(0, 0, 255, 1.0)',
      width: 2
    })
  })
});

This query returns 1.5mb of data - but nothing gets displayed. I also tried the same with this format:

new ol.format.WFS({gmlFormat: ol.format.GML2()})

As well as new ol.format.GML 2 & 3 - no luck. And I tried it with this line of code at the end of the url:

'&bbox=' + extent.join(',') + ',EPSG:6.9:25832'

If I add this (as seems to be recommended in the OL examples) the 1.5mb of data is not returned. It should be a very simple thing to include this data in an OL map!

marked as duplicate by nmtoken, Andre Silva, Vince, Fezter May 28 '18 at 0:04

This question was marked as an exact duplicate of an existing question.

  • 1
    The data come in this coordinate system: urn:ogc:def:crs:EPSG:6.9:25832. Have you initialized your OL map to use the same CRS, or have you written code to re-project data? – user30184 Mar 21 '18 at 15:34
  • 1
    The option to do that is setting the views projection attribute to 'EPSG:6.9:25832'? Ref.: openlayers.org/en/latest/doc/faq.html – ill Mar 21 '18 at 15:59
  • could you maxbe point me in the right direction? is this the right start? let projection = new ol.proj.Projection({ code: 'EPSG:6.9:25832', extent: [548365.31599999964, 5916926.2009999994, 588010.40799999982, 5955161.6950000003] }); this.mapView = new ol.View({ center: ol.proj.transform([565182.697851, 5935493.74369], 'EPSG:4326', 'EPSG:6.9:25832'), zoom: 9, projection: projection }); The extends are from the Corners from the GML. Center is any coordinates within the bounds? – ill Mar 22 '18 at 10:16