如何在使用 geojson-vt 创建的地图上设置最大缩放

How to set max zoom on map which is created using geojson-vt

     if(leafletMap == null){

    leafletMap  = L.map('mapDiv')
          .setView(defaultLocation, defaultZoom)

Layer= L.tileLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}")
   .addTo(leafletMap);

    var tileOptions = {
        maxZoom: 20,  // max zoom to preserve detail on
        tolerance: 5, // simplification tolerance (higher means simpler)
        extent: 4096, // tile extent (both width and height)
        buffer: 64,   // tile buffer on each side
        debug: 0,      // logging level (0 to disable, 1 or 2)

        indexMaxZoom: 20,        // max zoom in the initial tile index
        indexMaxPoints: 100000, // max number of points per tile in the index
    };
    //-------------------------------------------------
}

     tileIndex = geojsonvt(data, tileOptions);



    tileLayer = L.canvasTiles()
                  .params({ debug: false, padding: 5 })
                  .drawing(drawingOnCanvas)


    var pad = 0;

    tileLayer.addTo(leafletMap);

我确实尝试了很多方法,但无法设置 max zoommin zoom。如果有人能帮助我,那就太好了我已经尝试过了,但它不起作用:

var options = {
      maxZoom: 17,
      minZoom:10
};

leafletMap  = L.map('mapDiv',undefined,options)
          .setView(defaultLocation, defaultZoom)

你说这个不行:

L.map('mapDiv', undefined, options)

但是L.map()工厂的方法签名是Leaflet API documentation clearly states

L.map(id, options)

让我想知道你为什么把 undefined 放在那里。