Skip to content

Add a simple control to bump the zoomOffset beyond the default / retine / hdpi setting. This allows you to view higher zoom-level tiles in a large display. Mind your bandwidth, though.

master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

Leaflet.Control.DetailLevel

Add a simple control to bump the zoomOffset beyond the default / retine / hdpi setting. This allows you to view higher zoom-level tiles in a large display. Mind your bandwidth, though. See also this question on StackOverflow.

Demo

Demo

Source code

Repository on github

Usage

The simplest is to include this plugin after including leaflet:

    <script src="leaflet.js"></script>
    <script src="leaflet.control.detaillevel.js"></script>

and then add your control using

    let detailControl = new L.Control.DetailLevel(0, 4);
    detailControl.addTo(map);

where the arguments to the constructor are your mininum and maximum detail level == minimum/maximum zoomOffset. Please be aware that the number of tiles on display grows as 2^(zoomOffset), meaning that with zoomOffset = 3 you already display 8 times as many tiles as you would ordinarily.

License

This plugin is licensed under the MIT license, which is included in the head of the source file. Meaning: do whatever you want, but you cannot blame me if anything breaks.

About

Add a simple control to bump the zoomOffset beyond the default / retine / hdpi setting. This allows you to view higher zoom-level tiles in a large display. Mind your bandwidth, though.

Resources

Releases

No releases published

Packages

No packages published