简体   繁体   中英

How do I limit the Zoom level of my map, Mapbox

Hey,

I am currently using mapbox www.livehazards.com. It is a live earthquake map

I am getting 7x mapviews vs adviews and if my website was to become successful it would be financially unsustainable.

I think the problem could be that when a person zooms in that is counting as 4-6 new mapviews?? Do you think this is correct

....How do I limit the zoom level to 3 (Current Default) so users cannot zoom in any further

Thanks

If by "mapbox" you mean Mapbox-GL-JS, you can specify zoom limits when you create the map with maxZoom and minZoom :

var map = new mapboxgl.Map({
  container: 'map',
  center: [-122.420679, 37.772537],
  zoom: 13,
  maxZoom: 15,
  minZoom: 13
});

I think the problem could be that when a person zooms in that is counting as 4-6 new mapviews?? Do you think this is correct

In the context of GL JS a "map view" is defined as 4 tiles. See this page for more details: https://www.mapbox.com/help/define-map-view/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM