I have downloaded many vector tiles in the mbtiles format from OpenMapTiles. The reason I did that is because I will be using them on a station that cannot have an internet connection at all.

I would like in the end to see these tiles with leaflet on a browser, but it seems that the plugin for leaflet only considers raster-based tiles and not vector-based tiles, or so I thought until I saw Loading vector tile layer in Leaflet map? here on GIS. However, it seems to be outdated and the JSFiddle doesn't work anymore... So I figured I would try it out myself, but it did not work. So I am currently inclined to think that this plugin only works with raster tiles and not vector ones.

I also considered then converting my tiles to PNG so that I could use them with leaflet and used mbutils for that, as suggested on GIS at Finding good Mbtiles to png tiles converter? but obviously none of the generated PNGs are readable by my OS or leaflet as mbutils doesn't raster them.

I have two questions depending on how you advise me:

  1. Is it possible to read vector tiles with leaflet?
  2. If not, how is it possible to convert them to raster?

I cannot use commercial services like maptobox or any similar services, this the reason why I was trying to have everything running on my machine right away.

I have seen before the vector grid from leaflet. It says that it can read vector-tile files but when you click on it to get the documentation it says:

This library reads Mapbox Vector Tiles and allows access to the layers and features.

As for the Leaflet.TileLayer the documentation says that TileLayer is for rasters.

  • It is possible, check out these links. github.com/Leaflet/Leaflet.VectorGrid esri.github.io/esri-leaflet/api-reference/layers/… I have used the Esri tiles but not created any. – Bill Chappell Aug 14 '18 at 18:28
  • @BillChappell are the two links connected? Cause I cannot use any kind of hosting service (like Esri then I suppose). The first link you provided says that it can read vector-tile but then when I click on it I get that "This library reads Mapbox Vector Tiles and allows access to the layers and features." – LBes Aug 14 '18 at 18:32
  • Before VectorGrid, loading vector tiles in Leaflet could only be done with the Leaflet.MapboxVectorTile or the Hoverboard plugin, but neither of those works with Leaflet 1.0.0 (or greater). VectorGrid leverages the GridLayer feature introduced in Leaflet 1.0.0. from the first link – Bill Chappell Aug 14 '18 at 18:36
  • github.com/Leaflet/Leaflet.VectorGrid is the first link – Bill Chappell Aug 14 '18 at 18:37
  • @BillChappell but the documentation stills says that it can only do Mapbox... See: github.com/mapbox/vector-tile-js – LBes Aug 14 '18 at 18:38

Your Answer

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

Browse other questions tagged or ask your own question.