openlayers: IndexSizeError on IE11 when rendering SVG icons as map points

Describe the bug Trying to render icons as points on the map based on an SVG URI (base64 encoded). Works fine on Chrome, Safari, Firefox but not IE11. An IndexSizeError is thrown: image

after digging into this a bit more it looks like x and/or y params are negative values in the points generated, and IE11 seems to be the only browser that has an issue with this

I’ve looked through all the other issues related to this and have tried suggested fixes, however these have not worked. Hopefully I am missing something but happy to contribute towards a bug fix if required

To Reproduce Minimal Repo to reproduce https://github.com/ben-cloud9/openlayers-ie-11

  1. clone this repo
  2. install dependancies npm install
  3. run npm start and go to localhost:1234 in IE11
  4. an IndexSizeError will be thrown on map render
  5. no issues opening in any other browser

Expected behavior Icons to render on map points as in other browsers

Thanks in advanced and let me know if you need any further info 😃

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

@ben-cloud9 you need to set the imgSize: [width, height] property for ol.style.Icon. This fixed SVG icons for me in IE11.