-
Hello, I try to replace the svg container of example and add my svg file with a simple function
It's works (in this case i can saw my two layers) but the SVG is static, so it is blurred when i'm zooming in. So i would like to have the svg loaded like the example, to have all calculations for zooming and no resolution lost, but with the ability to add some layers on it, like a simple Waypoint for example. Globally, if you could show me how to add this : https://openlayers.org/en/latest/examples/icon.html on this : https://openlayers.org/en/latest/examples/svg-layer.html as a layer, it will be very cool ! Thank you so much, Raynoxis |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Instead of using 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 |
Beta Was this translation helpful? Give feedback.
-
It could be an additional example - the current one enables interactions with the svg. |
Beta Was this translation helpful? Give feedback.
Instead of using
ol/source/ImageStatic
, useol/source/Image
withol/source/static
'screateLoader()
function andol/source/Image
'sload
loader:This will work like
ol/source/ImageStatic
, but without making the image blurry. See https://codesandbox.io/p/sandbox/svg-layer-forked-5ry6rp.