Search code examples
svgrenderingopenlayers

Displaying SVG as an ImageLayer - OpenLayers


As flagged in the following GitHub issues, OpenLayers do not display SVG images properly when referenced in an ImageLayer:

https://github.com/openlayers/openlayers/issues/4633

There was a solution to this implemented a few months ago, using the "render" property in the Layer class: https://openlayers.org/en/master/apidoc/module-ol_layer_Layer.html#~RenderFunction

But i cannot figure out how to implement this correctly. What is the frame state, and how can this be referenced correctly to the render property?


Solution

  • The devs behind OpenLayers have created an example to show how an SVG image can be rendered:

    https://github.com/openlayers/openlayers/pull/10363