MapBox MB Tile vs Vector Tile
Asked Answered
B

2

13

I am a bit confused about Tiles in MapBox. As I understood, a tile is a little piece of map, as in a jigsaw puzzle.

MBTiles are images, but they are connected to a database to read data & let interactions be possible. So if I move the mouse, I can show details of the layers under the cursor.

Vector Tiles store all the data in vectors, and they are just used for a fast rendering of the image. Interaction with such data is not possible.

Am I wrong?

Now, I see that there is the tool TileMill for MBTiles, and MapBox Studio Classic for Vector Tiles. I guess they are for different purposes; the first for interactive maps, the latter for fast rendering. So.... why is TileMill not supported anymore, in favor of MBStudio? Is it possible to make interactive maps with MBStudio as well?

Thank you

Bejarano answered 28/10, 2015 at 9:19 Comment(0)
B
23

This is a great question!

mbtile is a filetype that can contain either raster or vector tiles. Think about it like an Adobe Illustrator .ai file -- it can either contain vector or raster data. Both raster tiles and vector tiles can be in mbtile format.

With TileMill, your vector data (shapefile, CSV, etc.) was combined with your CartoCSS style and passed to Mapnik to generate a bunch of tiled images. You could then store your tiles and feed them to a web map via a tile server. With Mapbox Studio Classic, you are converting your data to vector tiles and creating a CartoCSS style to style the data, but the image tiles aren't created until the map is requested via the browser. Ultimately, the output on the map is the same -- a grid of raster tiles.

The interactivity you created in TileMill with raster tiles is happening via a UTFGrid. This is an invisible raster layer that sits beneath the image tiles and adds interactivity to certain locations. The interactivity is not actually connected to any individual features at all -- it's just at the same location as your features. This is also possible in Mapbox Studio Classic, as the output in the map will also be a grid of raster tiles. You can read more about how to do this in Mapbox Studio Classic in the style quickstart guide.

So to answer your question, the move to Mapbox Studio Classic was to take advantage of vector tiles. They are a lot smaller than raster image tiles, and they can be styled on the fly, so, for example, you don't have to store two separate sets of images to accommodate retina screens. It also means you can have multiple styles applied to the same vector data on the fly, which means you don't have to regenerate a whole set of images for every style or every small change.

Buonarroti answered 29/10, 2015 at 19:30 Comment(2)
is it possibile to add such a interactivity to multiple layers in one style-project? Or I should create multiple styles, each one with its interactive UTFGrid, and than add them to the map as separate layers?Bejarano
FWIW, the mbtiles specification (as of writing - v1.2) only supports raster data. But there's a widespread habit of ignoring the spec. and stuffing vector data in there. The data is in typically the form of zipped Mapbox Vector Tiles.Boleslaw
E
0

If the Metadata table contains a record format=pbf then the mbtiles is a vector tiles and not raster. mbtiles SQLite database can be a container for vector tiles which have in the Tiles table and tile_data blob field PBF -Protocol Buffers - protobuf ( https://github.com/google/protobuf – language neutral platform neutral mechasism for serializing structured data) Developed by Google. Tools like MapBox Studio build vector tiles from GIS Vector Data and databases

Endear answered 14/12, 2016 at 18:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.