0

I made a little selfmade mapserver (just with some pictures (tiled 256x256 pixels)).

It's made with fixed zoom (just level 12 nothing else).

Now it works fine and I'd like zoom too. ;-)

Now I wonder if I can just zoom in browser only (with leaflet)... So just use the giving tiles without loading higher detail tiles.

I know, browser get more lag. But's not a problem. It's just a little map for private use only.

var mymap = L.map( 'mapid' ).fitWorld().setView( [ uriparm( 'lat' ) || 0, uriparm( 'lon' ) || 0 ], 12 );

L.tileLayer( 'getbox.php?folder={id}&lz={z}&lx={x}&ly={y}&lid={id}&ld=1', {
    maxZoom: 12,
    minZoom: 12,
    attribution: '',
    id: test
} ).addTo( mymap );
Md.Sukel Ali
  • 2,987
  • 5
  • 22
  • 34
FlowOver
  • 33
  • 5
  • This may help you:https://stackoverflow.com/questions/18687120/leaflet-zoom-in-further-and-stretch-tiles – YaFred Feb 13 '19 at 08:18

1 Answers1

0

Leverage the minNativeZoom and maxNativeZoom options of L.TileLayer. Quoting from the docs:

maxNativeZoom

Maximum zoom number the tile source has available. If it is specified, the tiles on all zoom levels higher than maxNativeZoom will be loaded from maxNativeZoom level and auto-scaled.

(idem for minNativeZoom)

Therefore, if your tile server only has level 12 tiles, you should try something like:

L.tileLayer( 'getbox.php?folder={id}&lz={z}&lx={x}&ly={y}&lid={id}&ld=1', {
    maxNativeZoom: 12,
    minNativeZoom: 12,
    maxZoom: 14,
    minZoom: 10,
    attribution: '',
    id: test
} ).addTo( mymap );

Feel free to experiment with those values a little, but be aware that a big discrepancy between minZoom and minNativeZoom will cause your browser to try to load a few million tiles, and very probably crash.

Community
  • 1
  • 1
IvanSanchez
  • 18,272
  • 3
  • 30
  • 45
  • oh... I overlook it in the doc - I think ~ great - works (with a bit lag) wonderfull - many thanks :-) – FlowOver Feb 13 '19 at 12:06