Charles Harrison
Charles Harrison

Reputation: 153

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

Upvotes: 7

Views: 12069

Answers (2)

Lucas Wojciechowski
Lucas Wojciechowski

Reputation: 3782

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/

Upvotes: 1

Steve Bennett
Steve Bennett

Reputation: 126025

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
});

Upvotes: 14

Related Questions