- 🇩🇪Germany e5sego
I got the same issue in the 10.1.0 version of this module and found a solution.
The library js/leaflet/dist/leaflet.js has a hardcoded value for maxZoom set to 18, which has to be changed to 22.
Attached you will find a fixed and zipped version of this file.
(a patch does not make sense for compressed javascript) - 🇮🇳India newswatch Delhi/Bangalore
Solution #6 is perfect. I set it to the max level of 22, and the result is just as desired :)
- 🇺🇸United States chucksimply
Worked for me as well! Thanks! Is there no way to make this more of a permanent fix?
- 🇺🇸United States chucksimply
Why would a patch not make sense? Every time the module is updated, the MaxZoom reverts back to 18.
- 🇩🇪Germany e5sego
I meant it technical-wise. The compressed leaflet.js has only one line of real code, so the patch contains the whole file.
But for those who want to automate the process of patching using composer, I attached a patch file.
The regarding section for composer.json would look like:
"patches": { "drupal/leaflet": { "Fix leaflet maxZoom factor. See https://www.drupal.org/project/leaflet/issues/3247962": "https://www.drupal.org/files/issues/2023-11-01/3247962-Leaflet-fix-maxZoom.patch" } }
- Status changed to Fixed
about 1 year ago 11:29pm 2 November 2023 - 🇮🇹Italy itamair
To increase the Max zoom to the selected Tiles the proper "maxZoom" property is required to be set in the "options" definition of the specific Leaflet Map Tile (whose max zoom I want to enhance), as suggested from the following Stackoverflow page: https://stackoverflow.com/questions/38126343/leaflet-how-to-increase-max...
In particular see the example implementation of the hook_leaflet_map_info() in the leaflet.api.php
So for instance I should could set the following definition of the OSM Mapnik:
/** * Implements hook_leaflet_map_info(). */ function mymodule_leaflet_map_info() { return [ 'Custom OSM Mapnik' => [ 'label' => 'Custom OSM Mapnik', 'description' => t('Leaflet OSM Mapnik map with 22 Max Zoom.'), 'settings' => [ 'dragging' => TRUE, 'touchZoom' => TRUE, 'scrollWheelZoom' => TRUE, 'doubleClickZoom' => TRUE, 'zoomControl' => TRUE, 'zoomControlPosition' => 'topleft', 'attributionControl' => TRUE, 'trackResize' => TRUE, 'fadeAnimation' => TRUE, 'zoomAnimation' => TRUE, 'closePopupOnClick' => TRUE, ], 'layers' => [ 'earth' => [ 'urlTemplate' => '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'options' => [ <strong>'maxZoom' => 22,</strong> 'attribution' => '© <a href="https://www.openstreetmap.org/copyright" rel="noopener noreferrer" target="_blank">OpenStreetMap</a> contributors', ], ], ], ], ]; }
and I will be able to successfully Zoom-in further then 18 if:
- I also properly set the Leaflet Map "Max. Zoom" option higher than 18 ...
- The specific Map Tile (in this case the OSM Mapnik ...) properly supports and provides Map Tiles at Zoom level higher than 18 ...
You could also simply tryout the attached patch that alters the Leaflet module OSM Mapnik default definition to have a Max Zoom of 22 ...
Automatically closed - issue fixed for 2 weeks with no activity.