opoto/wtracks

Browser tab freezes when using a WMS layer

Hufkratzer opened this issue · 2 comments

If I have a WMS layer (overlay) active, the whole browser tab freezes after a while; then I have to close it and start a new one.

It happened with different WMS layers (overlays). It does not happen with TMS layers (overlays). Sometimes it happens after just a few actions, but sometimes it takes much longer. It happens the faster, the higher the zoom level is. It happened in Opera, Chrome and IE on Windows.

You can try to reproduce it with this overlay:
https://opoto.github.io/wtracks/maps.html?import=eyJSZWl0d2VnZSBHUiI6eyJvcHRpb25zIjp7Im1pblpvb20iOiIiLCJtYXhab29tIjoiMTciLCJsYXllcnMiOiJMNDEyIiwiY3JzIjoiRVBTRzo0MzI2Iiwic3R5bGVzIjoiZGVmYXVsdCIsImZvcm1hdCI6ImltYWdlL3BuZyIsImF0dHJpYnV0aW9uIjoiIn0sInVybCI6Imh0dHBzOi8vZ2lzLWxrZ3IuZGUvcHVibGljL29nY3NsLmFzaHg_Tk9ERUlEPTU3MyIsInR5cGUiOiJ3bXMiLCJvdmVybGF5Ijp0cnVlLCJuYW1lIjoibGtyZ3IifX0=
It shows some ways in East Germany. Go to a high zoom level and pan the map around a bit. Perhaps you are lucky and can reproduce it quickly.

opoto commented

Hi
I can reproduce this issue. It looks like the freeze is happening within the leaflet code (the core library displaying the maps), and not in wtracks, so I am not sure I can do anything about it. I will however have a closer look.

opoto commented

I eventually found the cause of this issue: tile auto-scaling does not work well on WMS overlays.
Auto-scaling is a leaflet feature allowing to zoom beyond the configured max zoom of a map/overlay.
Your overlay has max zoom set to 17. When zooming to 18 WTracks (thanks to leaflet) was scaling the level 17 tile images to fit the level 18. This works for map backgrounds and other overlay types, but not for WMS (I have no clue why and how to fix this, this is outside of WTracks scope). I thus deactivated auto-scaling for WMS overlays, while keeping it for the backgrounds and other overlays.
After this fix, when you zoom to a level higher that the WMS overlay max zoom (17 in yours), the overlay will not be displayed anymore. To avoid this you can configure a higher max zoom for your overlay, as long as the overlay supports it (your does).
FYI current zoom level is displayed in debug console logs.