mapbox / vector-tile-spec

Mapbox Vector Tile specification
https://www.mapbox.com/vector-tiles/specification/
Other
900 stars 210 forks source link

Vector vs Raster tiles size #53

Closed jzarzuela closed 8 years ago

jzarzuela commented 8 years ago

Hi, I read that vector tiles would be much more space efficient than raster tiles. But comparing what your HTML or iOS demo apps are downloading it doesn't look like so.

For example:

http://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/14/4823/6160.vector.pbf?access_token={token}

https://api.mapbox.com/v4/mapbox.streets/14/4823/6160.png?access_token={token}

Results in downloading 16.725 bytes PNG versus 35.206 bytes PBF file.

How is it possible?

flippmoke commented 8 years ago

@jzarzuela Great Question!

Let me explain in detail why this file is much more complex, this tile contains a LOT of information and there is a lot you can do with the vector tile! Here is a short list of the number of features in this layer:

6160

This is all to produce this tile:

image

The important thing to note is that this tile may not just be used to create just one raster tile if you wanted. You can create other raster tiles from zoomed in data! This means it is actually possible to zoom into something much more detailed from this layer with out reloading in GL.

Here is a debug tool we are working on for vector tiles (that we hope to one day share with everyone), and you can see us zooming in on the data in the tile that you provided for the building layers:

6160_zoomed

You can see how much additional detail is provided for just one layer of information! So while:

16.725 bytes PNG versus 35.206 bytes PBF file. is for the zoom level 14 tile. If that tile is sufficient for all zoom layers between 14 to 18, you have effectively provided information for 4^4 + 1 tiles. So that is roughly (256 * 16.725) bytes worth of PNGs.

You also contain more information in the vector tile that is not at all used in that style. This means you can:

All of these are not possible with just the raster tile.

jzarzuela commented 8 years ago

Thanks for the detailed awnser. It's awesome!.

Just one last question:

Although, as you mention, the same tile could be used for other zoom levels (and safe all the space it claims), as far as I know the framework asks for more tiles using the previous URL as a template in the form of: http://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/{zoom}/{x}/{y}.vector.pbf?access_token={token}

So, in fact, it doesn't really safe any space... Does it?

Would it possible to force it to reuse that tile for other zoom level?

Thanks.

jfirebaugh commented 8 years ago

The savings comes from two sources:

  1. vector tiles for a given zoom level cover 4 times as much area as raster tiles at the same zoom level. So the comparison is more like:

Raster: 16 kb * 4 (67 kb) PBF: 35 kb (~2x smaller)

  1. Vector tile sets have a maximum zoom level (usually z14). Beyond that, the existing tiles are overzoomed (no more tiles are downloaded).
mourner commented 8 years ago

Check out this comparison chart I just made: https://plot.ly/~mourner/118.embed

image

markeberhart commented 8 years ago

Really helpful info! Great way for me to explaining n vector benefits to others.

flippmoke commented 7 years ago

@cccruzr some resources to understand overzooming:

zxp209 commented 5 years ago

How convert the mapbox vector tile to a png tile? Thanks.

springmeyer commented 4 years ago

How convert the mapbox vector tile to a png tile?

The Mapbox Static API is designed to do that: https://www.mapbox.com/static-maps. Additionally, there are many ways to convert vector tiles into other, visual representations. One of my favorites is vector tile -> svg done by https://github.com/mapbox/mvt-cruncher