1

I want to use an SVG file as a source for one of the layers for my map in OpenLayers. The svg file is in a coordinate system such that it overlays my coordinate system of my map. I have tried the code below but it gives me

AssertionError "Assertion failed. See https://openlayers.org/en/v5.3.3/doc/errors/#7 for details.

let Tunnel = new vectorLayer({
          source: new VectorSource({
            projection: projection2326,
            url: 'assets/Tunnel.svg',
            wrapX: false
          }),
          extent: [813967.0186951972, 825986.8061076261,814705.0826232458, 817842.6498878849]
        });



 this.map = new Map({
      target: 'map-container',
      layers: [
        new TileLayer({
          source: new OSM({ 
          wrapX: false
        })
      }), Tunnel
      ],
      view: new View({
        projection: projection2326,
        center: getCenter(extent),
        zoom:13,
      })
    });
6
  • Correct address for error code desciption is openlayers.org/en/latest/doc/errors/#7. Error desciption says: format must be set when url is set.
    – TomazicM
    Commented Aug 26, 2019 at 6:23
  • I do not understand what this means ? Commented Aug 26, 2019 at 6:57
  • See docs for VectorSource: openlayers.org/en/latest/apidoc/…
    – TomazicM
    Commented Aug 26, 2019 at 7:12
  • I have seen it, I tried adding format: new FeatureFormat({ dataProjection: projection2326, featureProjection: projection2326 }), Commented Aug 26, 2019 at 7:24
  • gives me another error which is "core.js:7187 ERROR Error: Unimplemented abstract method." Commented Aug 26, 2019 at 7:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.