1

Using Open Map Tiles with mapbox gl js, when zooming higher than zoom 14 I get errors in the browser console:

mapbox-gl.js?d5ed:510 Error: Error
    at Actor.receive (mapbox-gl.js?d5ed:490)
Evented.fire @ mapbox-gl.js?d5ed:510
Evented.fire @ mapbox-gl.js?d5ed:510
Evented.fire @ mapbox-gl.js?d5ed:510
t._tileLoaded @ mapbox-gl.js?d5ed:222
i @ mapbox-gl.js?d5ed:230
Actor.receive @ mapbox-gl.js?d5ed:490

This fiddle shows this behavior. Please fill in your own OMT key and then it works. The error is [object Error] { ... } it show everywhere zooming above zoom 14 and in some areas already above zoom 11.

I am pretty sure it relates to no tiles being available, however this should simple extend features of zoom 14 instead of giving an error, I would think. What is causing and how can I get rid of these errors?

musicformellons
  • 12,283
  • 4
  • 51
  • 86

1 Answers1

3

When you create a tile based source (raster or vector) with mapbox-gl you can define minzoom & maxzoom levels. If set correctly mapbox won't request tiles above/below those levels, but will still show tiles with the biggest/lowest zoom level available:

map.addSource({
  tiles: [/* tile urls */],
  maxzoom: 11,
  // etc...
});
Scarysize
  • 4,131
  • 25
  • 37
  • Yes I know, but all OpenMapTile features stop at zoom 14. The idea is that you should be able to have these still appear at higher zooms. At least that's how I understand things... – musicformellons Jan 08 '18 at 20:31
  • They will still appear if you set the maxzoom level. Tiles with greater zoom levels just won't be requested. – Scarysize Jan 08 '18 at 20:34
  • When I add ```'maxzoom': 15,``` to the waterlayer in my fiddle and then scroll higher than zoom 15 the water disappears. So no, the max and minzooms really determine whether features show y/n. Thus this does not work. – musicformellons Jan 08 '18 at 20:48
  • Per documentation, max & minzoom properties work as I described: https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-vector-maxzoom. You have to define those levels on the source not the layer. – Scarysize Jan 08 '18 at 20:52
  • Man! Thanks 1000x! I was blind..., I thought you meant maxzoom on the layer, but you are right: it has to be set on the source! Workz now!! – musicformellons Jan 08 '18 at 21:12
  • 1
    `minzoom` and `maxzoom` exist on both layer and source, with slightly different semantics. – Steve Bennett Jan 09 '18 at 03:18