Too many requests on ImageWMS layer

421 views Asked by At

I believe this may be a bug but will check here first. In a simple map with just two layers, a Google layer and an ImageWMS layer generated by MapServer a simple zoom creates 8 to 10 WMS requests when only one request should be made. You can see this here (filter the network tab for "mapserv64")

https://www2.greenwoodmap.com/fremontid/olgm.html

Turning off the Google layer googleLayer.setVisible(false) Make it even worse, generating 16 to 18 requests.

Each WMS request is for an image that is zoomed it a little more. Sort of like an animated zoom making a WMS request for each "step". I'm working with ol3gm 0.14. For comparison, here is the same map without the Google layer using ol 4.1.1 which only makes one WMS request per zoom.

https://www2.greenwoodmap.com/fremontid/olgm0.html

And another example using ol3gm 0.14 but with a TileWMS rather than an ImageWMS which (correctly) requests 9 tiles when zooming in with the Google layer turned off. It seems to request a few extra blank tiles when the Google layer is turned on.

https://www2.greenwoodmap.com/fremontid/olgmTile.html

So am I missing a zoom setting or is this a bug?

1

There are 1 answers

1
Alexandre Dubé On

OLGM is based onto OpenLayers. It listens to the map view resolution and center change to adjust the Google Maps' map.

Before OpenLayers 3.20.0, the view "change:resolution" event was fire once if the user (for example) zoomed the map with the mouse scroll button. Since 3.20.0, multiple events are fired while animating. This makes OLGM try to re-render the tiles multiple times instead of only once. This may be what you're experiencing.

Please, look at the following issue on GitHub and see if it's related to your issue.

For the meantime, you could downgrade to olgm 0.12.0 and see if that fixes your issue. That version uses OpenLayers 3.19.1.