5

When I zoom to maximum; more than 18 the basemap is gone. How can we keep the basemap even when we zoom to maximum? This is my plunker example

5

The Tile Layer maxZoom option default value is 18.

The maximum zoom level up to which this layer will be displayed (inclusive).

That is why it is automatically hidden when you zoom past level 18.

To keep it visible, simply specify that option when instantiating the Tile Layer:

var OSMRoads = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  maxZoom: 22,
  maxNativeZoom: 19
}).addTo(mymap);

Note that in the case of OpenStreetMap, the Tile Server does not send images for zoom level higher than 19. But you can use the maxNativeZoom option to have Leaflet keep images from the last available zoom level and scale them up:

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.

Updated Plunker: https://plnkr.co/edit/1zgrFv504ywvbuo2QHLe?p=preview

  • Awesome resolution !!! – shoab Jun 21 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.