0

I'm using OpenLayers 6.13 in an iOS app. The app also runs on macOS (Mac Catalyst). The OpenLayers component runs in a WKWebView (essentially a Safari-esque web browser view, embedded in the app).

When running on the Mac if I increase the size of the window, the vector layers disappear and the javascript console reports the error:

Canvas area exceeds the maximum limit (width * height > 16777216).

If I decrease the window size again, the layers re-appear on the map.

(The WMTS layers never disappear, even when the window is larger.)

What's very odd about this, is that I can get the same layers to run in a very similar actual web site in actual Safari in the same map in a much larger browser window. The problem only seems to exist in my WKWebView.

How can this error be avoided in larger windows with OpenLayers?

2
  • 2
    If the problem to due to a very high resolution device you could set the pixelRatio option in the map constructor. Otherwise try v6.15 or later there were some efforts made to reduce canvas use github.com/openlayers/openlayers/releases/tag/v6.15.0
    – Mike
    Commented Sep 10, 2022 at 9:27
  • Thanks @Mike , v6.15.1 did not help, but changing the map's 'pixelRatio' to 1.0 did resolve it. I think that this is going to be the solution for me for now. If you write it up as an answer, I'll be happy to mark it correct (otherwise, I will do so later). Commented Sep 11, 2022 at 5:44

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.