2

I'm struggling to put together the appropriate stack for rendering raster tiles (for display of slippy maps) from a given Mapbox GL style.

Style specifications: First there were the Mapnik XML stylesheets, which were then superseded by CartoCSS, which in turn are to be replaced with Mapbox GL styles. That's quite an evolution. It is costly to move from one to the other, so today the best option is to go with Mapbox GL styles, if possible.

Style conversions: To my knowledge, the only automated style conversion available is CartoCSS to Mapnik XML using TileMill.

Map editors: MapBox Studio Classic works with CartoCSS. It is replaced by Mapbox Studio, which instead works with Mapbox GL styles. Maputnik, a FOSS alternative to Mapbox Studio, also works with Mapbox GL styles. (Actually, prior to Mapbox Studio Classic there was TileMill, which also works with CartoCSS, and can export Mapnik XML.)

Obviously Mapbox GL styles are intended to be used with MapBox GL js, which uses WebGL. On new hardware this is very nice indeed. On older hardware, without graphics acceleration, MapBox GL js is not an option, however. Yet it desirable to use one style specification to render both with Mapbox GL js and with the old-fashioned raster tiles.

The first conclusion is that, today, we can safely discard MapBox XML.

This leaves the following options:

  • Use Mapbox Classic, work with CartoCSS: There is no path to Mapbox GL js rendered maps
  • Use MapBox Studio or Maputnik with Mapbox GL styles: There is no path to old-fashioned raster tiles

Am I missing something? Ideally it should be possible to render raster tiles with the MapBox GL toolkit, but I don't see how.

  • While playing around with Klokantech's tileserver-gl I noticed that it also serves raster tiles, e.g. localhost:8080/styles/osm-bright/11/1072/717.png. It's quite slow, though. – mcmayer Aug 17 '17 at 7:48
  • Did you ever figure out a solution? I'm having similar troubles. Maputnik seems great for creating the style, and I can download vector map data for the whole planet for free, but can't seem to find a tool to generate all raster tiles (down to some specified level) from the Mapbox GL style and the vector data. Surely that exists? Thanks! – Chris Bartley Nov 28 '17 at 22:47
  • Yes, as I commented above, Klokantech's tileserver-gl can do it, albeit rather slowly. Beyond that the situation is rather bleak, AFAIK. – mcmayer Nov 29 '17 at 10:02
  • Ah, thanks. Sorry, I guess I misunderstood. I read it as tileserver-gl can serve the tiles on demand, and just for the current viewport. I'm looking for something I can automate...essentially being able to tell it "generate all tiles for each level 0-14 for the entire planet" and then walk away and come back (much) later and have the full tileset waiting. If tileserver-gl can do that, even slowly, I'm happy. Thanks! – Chris Bartley Nov 29 '17 at 16:28
  • The whole planet? You'd have to come back much much later. You have to write a small script to extract all the tiles. Anyway, it would be nice if you report back if that works for you. – mcmayer Nov 30 '17 at 8:50
3

I finally gave up trying to find an existing solution and ended up using a combo of Maputnik, Tileserver GL, and a custom script to scrape raster tiles from Tileserver GL. Details are here: https://github.com/CMU-CREATE-Lab/tile-generation

Hope this helps.

  • Why this gets down-voted is beyond me. I think you made a substantial contribution. Thanks! – mcmayer Dec 23 '17 at 9:37
  • Thank you so much for writing this up. It would be even more awesome if you included a summary of the steps in this answer, rather than just the link. – Steve Bennett Jan 23 '18 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.