Search code examples
here-api

How to set max zoom


So I noticed in the older version of the API there was a maxZoomLevel under nokia.maps.map.Display. However I can not find anything similar to this in the JS API 3.0.

Currently I am using

map.addEventListener('mapviewchange', function () {
    var zoom=map.getZoom();
    if(zoom<=maxZoom)  {
        map.setZoom(maxZoom)
    }
});

But once it hits the maxZoom and you zoom out more it is very choppy since it zooms out a bit then I set it back to maxZoom. Is there any better way of doing this?


Solution

  • You can set the max zoom for the layer, something like follow should work

    var defaultLayers = platform.createDefaultLayers();
    defaultLayers.normal.map.setMax(12);
    
    var map = new H.Map(mapContainer,
      defaultLayers.normal.map,{
      center: {lat:39.2328, lng:9.01168},
    });