Map - set maxNativeZoom on TileLayers

is it possible to set maxNativeZoom on a Leaflet.js layer (TileLayer.class)?

Something like this (in javascript):

L.tileLayer('http://{s}{z}/{x}/{y}.png', {
    maxNativeZoom: 19, // OSM max available zoom is at 19.
    maxZoom: 22 // Match the map maxZoom, or leave map.options.maxZoom undefined.

A working example on jsfiddle:

My goal is to set a high value on Map zoom (let’s say 22) so a user can continue zooming beyond layer maximum zoom (19) while the TileLayer will always remain visible (though it will blur).

I’ve seen that LTileLayer.class (extending LGridLayer.class) has setMaxNativeZoom() method but I don’t know how to access it.

How could I achieve this?

Thanks in advance.


Hi, Paolo

See the TileLayerLeafletLayerTranslator class. It is responsible for building Leaflet’s LTileLayer instances based on parameters of the GeoMap’s TileLayer. If you want to customize the translation logic, you can create the exact same bean in your project, but with priority higher than in the default implementation. For example, set @Order(965). As a result, you will override the out-of-the-box bean.
You can also create a subclass of TileLayer with the additional parameter: max native zoom. Then apply your implementation of layer translator only to instances of the subclass by changing the type value in @LayerTranslator annotation.


1 Like

Hi Gleb,
it works like a charm! :smile: :+1:

Thank you very much Gleb for your quick reply!

Have a nice day,

1 Like