Skip to content

Unable to see others layers when using a svg file as a background Layer #15758

Answered by ahocevar
Raynoxis asked this question in Q&A
Discussion options

You must be logged in to vote

Instead of using ol/source/ImageStatic, use ol/source/Image with ol/source/static's createLoader() function and ol/source/Image's load loader:

import ImageLayer from 'ol/layer/Image';
import ImageSource from 'ol/source/Image';
import {createLoader as createStatic} from 'ol/source/static';
import {load} from 'ol/Image.js';

const imageLayer = new ImageLayer({
  source: new ImageSource({
    loader: createStatic({
      url: 'datas/RDC.svg',
      imageExtent: [-180, -337, 284, 180],
      load,
    }),
  }),
});

This will work like ol/source/ImageStatic, but without making the image blurry. See https://codesandbox.io/p/sandbox/svg-layer-forked-5ry6rp.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Raynoxis
Comment options

Answer selected by Raynoxis
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants