Mapbox-gl-js: Zoom levels 1 less in GL than raster?

Created on 11 Aug 2014  路  8Comments  路  Source: mapbox/mapbox-gl-js

It appears that the zoom levels reported in GL are 1 less than the same data source rendered as raster tiles. See the attached images of the same area as GL and in the Mapbox project view:

gl zoom 12
raster zoom 13

Most helpful comment

Documenting this in Mapbox GL JS fundamentals would be helpful.

All 8 comments

Yes, tiles are drawn in 512px of screen space on GL, so the zoom level retrieved is off by one.

We had some extensive discussions about tile size and zoom level which we need to capture in documentation. If I recall correctly, the upshot is that this is the expected behavior: because GL renders 512px tiles, one tile at a given zoom level renders 4x the area as raster tiles, which have historically been 256px.

OK, makes sense, although I've always assumed the zoom value is just an arbitrary value. It does need documenting as it makes translating Mapbox Studio styles a bit more awkward - particularly as the data is exported using the 256px zoom references. How does it work with raster data?

Just found about this issue and I am really surprised. This is not a "minor documentation issue" - you practically decided that Mapbox GL is not slippy map, and it is not compatible with other standardized slippy map things - for example any server side code using standard zoom-to-scale-denominator (13 = 1:100000). You cant use one common datasource-level filtering based on zoom for both raster and vector tiles, you need different styling rules, etc. What a huge standard-breaker... This should be like first thing mentioned in the documentation - in big bold font.

Is there perhaps any way to setup Mapbox GL JS to work in slippy maps mode? 256px tiles, standard zoom levels?

Hmmmm, is there any chance this explains why I get incorrect results from mapbox/geo-viewport? https://github.com/mapbox/geo-viewport/issues/3

I use Mapbox's Static Image API, and I need to compute the bounding box of those images. Mapbox Support advised me that geo-viewport was written for this very purpose.

If I request a static image at MapboxGL zoom 17, and then ask geo-viewport to compute this bounding box, it gives the bbox for zoom 16 instead. I have to +1 to get the right answer.

I'm trying to learn enough about the underlying mapbox/node-spherical-mercator library to make a fix, but it sounds like it's mostly a misunderstanding on my part. I had absolutely no idea that GL changed the game in terms of zoom levels.

I'm honestly not fussed about the zoom matching with raster-based zooms. I just need a way to compute the bbox of a Mapbox Static Map API image.

I am closing this issue because the GL team feels 馃憤 about this decision and does not plan to revisit.

For posterity, the answer to my comment was:

Yes, the 512x512px tile size was the cause of my issue in https://github.com/mapbox/geo-viewport/issues/3

Documenting this in Mapbox GL JS fundamentals would be helpful.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jfirebaugh picture jfirebaugh  路  3Comments

rasagy picture rasagy  路  3Comments

rigoneri picture rigoneri  路  3Comments

BernhardRode picture BernhardRode  路  3Comments

PBrockmann picture PBrockmann  路  3Comments