2

I have multiple WMS layers. One of the layers is from a local GeoServer (UAV generated GeoTIFF). I am unable to zoom GeoTIFF up-to it's full resolution.

How to enable deep zoom in to WMS above 20% zoom level?

Here is my code:

<!DOCTYPE html>
<html>
<head>
    <title>Sample Web GIS using Leaflet and Geoserver</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
    <link rel="stylesheet" href="D:/Web_GIS/html/leaflet/leaflet.css"/>
    <script src="D:/Web_GIS/html/leaflet/leaflet.js"></script>
    <style>
        html, body {
            height: 100%;
            margin: 0;
        }
        #map {
            width: 600px;
            height: 400px;
        }
    </style>
</head>
<body>
<div id='map'></div>
<script type="text/javascript">
    var map = L.map('map', {
        center: [9.34, 76.55],
        zoom: 20
    });
    var basemaps = {
        Countries: L.tileLayer.wms('https://demo.boundlessgeo.com/geoserver/ows?', {
            layers: 'ne:ne_10m_admin_0_countries'
        }),

        Boundaries: L.tileLayer.wms('https://demo.boundlessgeo.com/geoserver/ows?', {
            layers: 'ne:ne_10m_admin_0_boundary_lines_land'
        }),

        'Countries, then boundaries': L.tileLayer.wms('https://demo.boundlessgeo.com/geoserver/ows?', {
            layers: 'ne:ne_10m_admin_0_countries,ne:ne_10m_admin_0_boundary_lines_land'
        }),

        'Boundaries, then countries': L.tileLayer.wms('http://localhost:8080/geoserver/Geoserverworkspace/wms?', {
            layers: 'Geoserverworkspace:Geotiff'
        })
    };


    L.control.layers(basemaps, {}, {collapsed: false}).addTo(map);
    basemaps.Countries.addTo(map);



</script>
</body>
</html>
5

As Stefan mentioned, L.map has the option for setting minZoom and maxZoom.

   var map = L.map('map', {
            center: [9.34, 76.55],
            zoom: 20,           
            maxZoom: 25 //(or even higher)
        });

In your example, L.tileLayer.wms has that option, too:

Countries: L.tileLayer.wms('https://demo.boundlessgeo.com/geoserver/ows?', {
            layers: 'ne:ne_10m_admin_0_countries',
            maxZoom: 28
)}

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.