OpenLayers 7 WFS 1.1.0 not drawing polygons when srsName contains opengis.net/gml/srs/epsg.xml

38 Views Asked by At

I'm writing a web app that uses WFS data on top of OpenLayers with OpenStreetMap. The entire project works in EPSG:2180 projection and uses multiple versions of WFS (depending on server). OL doesn't draw polygons on the map when srsName="http://www.opengis.net/gml/srs/epsg.xml#2180" instead of srsName="EPSG:2180".

I tried adding EquivalentProjections as in documentation and it even returns true on check. However, still, no geometries are drawn.

Code:

import proj4 from 'proj4';
import * as ol_proj4 from 'ol/proj/proj4.js';
import * as olProj from 'ol/proj';

[...]

proj4.defs("EPSG:2180","+proj=tmerc +lat_0=0 +lon_0=19 +k=0.9993 +x_0=500000 +y_0=-5300000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs +axis=neu");
ol_proj4.register(proj4);

var epsg_nazwa_xml = new olProj.Projection ({
  code: 'http://www.opengis.net/gml/srs/epsg.xml#2180',
  units: 'm',
  axisOrientation: 'neu',
  global: false,
  metersPerUnit: 1,
}) 
olProj.addProjection(epsg_nazwa_xml);

olProj.addEquivalentProjections([epsg_nazwa_xml, olProj.get('EPSG:2180')]);

console.log(olProj.equivalent(olProj.get('EPSG:2180'), olProj.get('http://www.opengis.net/gml/srs/epsg.xml#2180')))

[...]

/**
 * MAPA init
 */
var map = new Map({
  target: 'map',
  layers: [
    new TileLayer({
      source: new OSM(),
      projection: 'EPSG:2180'
    })
  ],
  view: new View({
    projection: 'EPSG:2180',
    center: miejsce,
    zoom: 14,
  })
});

[...]

WFSvectorSource = new VectorSource({
        format: new WFS({
          version: '1.1.0',
        }),
        url: function(extent) {
            return compURL+"&bbox="+extent.join(',')+",EPSG:2180";
        },
        strategy: bbox
      });
WFSvectorLayer = new VectorLayer({
      source: WFSvectorSource,
      projection: 'EPSG:2180',

      style: new Style({
          stroke: new Stroke({
              color: '#000000',
              width: 1
          }),
          fill: new Fill({
              color: 'rgba(255, 255, 255, 0.01)'
          })
      }),
    });
map.addLayer(WFSvectorLayer);

Example of working WFS link: https://corsproxy.io/?https://trzebnicki-wms.webewid.pl/iip/ows?service=WFS&request=GetFeature&version=1.1.0&srsname=EPSG:2180&typename=dzialki&bbox=357783.463892855,391038.4860643449,358805.47125767067,391700.3901630342

and not working WFS link: https://corsproxy.io/?https://geoportal.powiat.klodzko.pl/ggp?service=WFS&request=GetFeature&version=1.1.0&srsname=EPSG:2180&typename=dzialki&bbox=332468.6208316547,272386.1313619815,333179.64381146623,272819.1873043835

The only difference being in only in srsName in <gml:Polygon srsName="EPSG:2180"> vs <gml:Polygon srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#2180">

Any help appreciated!

0

There are 0 best solutions below