readFeatures on WFS causes target.addEventListener is not a function

45 Views Asked by At

I am writing a client which should extract the Features from multiple WFS sources and show them combined on a layer. Openlayers seems to provide everything i need with its WFS format class.

However using it to parse such a document fails with "target.addEventListener is not a function":

const gml = '<?xml version="1.0" encoding="UTF-8" >...<wfs:FeatureCollection "> ...
<gml:MultiGeometry srsDimension="2" srsName="urn:ogc:def:crs:EPSG::3035">
<gml:geometryMember> <gml:Polygon srsDimension="2"> ....';
new WFS({version: '2.0.0'}).readFeatures(gml);

with the following call stack

    TypeError
target.addEventListener is not a function
Call Stack
 listen
  node_modules/ol/events.js:68:10
 Feature.handleGeometryChanged_
  node_modules/ol/Feature.js:248:90
 Feature.dispatchEvent
  node_modules/ol/events/Target.js:119:11
 Feature.notify
  node_modules/ol/Object.js:183:12
 Feature.set
  node_modules/ol/Object.js:222:14
 Feature.setProperties
  node_modules/ol/Object.js:236:12
 new Feature
  node_modules/ol/Feature.js:150:14
 GML32.readFeatureElementInternal
  node_modules/ol/format/GMLBase.js:343:21
 GML32.readFeatureElement
  node_modules/ol/format/GMLBase.js:361:17

From what I understand the code in Feature.js intends to register a change listener on the geometry, which is in my case a MultiGeometry and doesn't have a member addEventListener:

debugger view

Everything else seems normal what I have seen from debugging. The geometry is detected as geometry and other properties are parsed too.

Could it be that openlayers GML32 implementation does not know how to handle MultiGeometry elements - so the xml-node is not converted to a subclass of Geometry (which would provide the addEventListener methods)?

I don't know how to proceed any further, and hint is highly appreciated.

0

There are 0 best solutions below