open source basecamp

RSS
Twitter
 
Blog

OpenLayers Client Zoom Feature

Camptocamp has been working on OpenLayers for several years. We’ve played a role in the development of many major features: “vector rendering”, “vector behavior”, “mobile support”, “kinetic dragging” to name a few. We’ve recently worked a new feature: “client zoom”.

When opening this map you quickly notice the “big squares” for the topographic layer (the “Color map” layer). Actually that layer cannot be better rendered at this resolution, because the display resolution is smaller than the resolution of the original data. The tiles making up this layer at this resolution were indeed generated by upsampling the original image.

The upsampling operation could actually be (equally?) performed by the browser, with two major benefits: save disk space on the tile server, and speed up tile generation.

But until today OpenLayers didn’t allow displaying a tiled layer at resolutions that weren’t supported by that layer’s tiling service. If the map was changed to a resolution that the tiling service didn’t support then non-existing tiles were requested, and “broken images” were displayed on the map.

On a contract with Swisstopo Camptocamp has been working on changing the situation, to make it possible to display tiled layers at resolutions that aren’t supported by the tiling services. The logic is simple: when the map is changed to a resolution that isn’t supported by a layer’s tiling service, OpenLayers requests tiles at a lower resolution for that layer, and scale the layer div using lower_resolution/map_resolution as the scaling factor.

Getting the patch right has been a bit of a challenge, but patch has finally been merged in OpenLayers’ development branch! An example of this feature is available online. Check it out!

Thanks Swisstopo for funding this work. And special thanks to Andreas Hocevar for his help and support, and the “percentage-based tile positioning” patch this work is based on.

Tags: ,

Leave a Reply