mapbox / mbtiles-spec

specification documents for the MBTiles tileset format
https://www.mapbox.com/help/an-open-platform/#mbtiles
Other
615 stars 99 forks source link

Explain how vector tile data is stored #43

Closed systemed closed 5 years ago

systemed commented 9 years ago

Vector tiles can also be stored in the MBTiles format.

It would be good if the spec explained how. From what I can tell:

The Mapbox.com implementation also appears to require a json metadata field containing various JSON-encoded values, but I'm presuming this is implementation-specific rather than part of the MBTiles spec.

JesseCrocker commented 9 years ago

Im using vector tiles stored in mbtiles files in mobile applications, with format set to pbf, and compressing the tiles with deflate(using zlib). I don't use a json metadata field.

incanus commented 9 years ago

This is also done by Mapbox Studio when uploading custom sources. I don't have a lot of info there, but you could check the source.

systemed commented 9 years ago

Yep. That's pretty much what I did - looked at mapbox-upload-validate and tiletype to figure out what Tilemaker should do. But it'd be good to have it canonicalised here.

e-n-f commented 9 years ago

Tippecanoe has another implementation of how to write the format. It seems like the json ought to be part of the spec unless there are other clients that don't require it.

mg262 commented 8 years ago

It's somewhat misleading to use pbf to mean zipped pbf. protobuf doesn't in itself have any support for DEFLATE (http://stackoverflow.com/a/7181908/1908650). format should contain something that indicates that the content is zipped PBF, rather than plain PBF.

NB. Not trying to be pedantic -- I have spent a lot of time on a wild goose chase due to this issue. I know that vector MBTiles contain zipped PBF, but it's still not clear to me whether it's legitimate for a vector tileserver to output either PBF or zipped PBF, or whether it has to be one of the two. If anyone knows, I'd be grateful for the clarification.

pnorman commented 8 years ago

NB. Not trying to be pedantic -- I have spent a lot of time on a wild goose chase due to this issue. I know that vector MBTiles contain zipped PBF, but it's still not clear to me whether it's legitimate for a vector tileserver to output either PBF or zipped PBF, or whether it has to be one of the two. If anyone knows, I'd be grateful for the clarification.

It can output either. It's common to only serve with a compressed HTTP Content-Encoding. Some implementations (notably Mapbox's) violate the HTTP spec by sending compressed data when identity is requested.

46 takes the route of having the tileset specify both the format (application/vnd.mapbox-vector-tile) and compression.

sfkeller commented 7 years ago

Ihope this issue will fixed soon (in #46 = version 2.0?)! In a first attempt to implement an MVT reader it took us literally days(!) of debugging, no realizing that PBF's are stored as zipped files in mbtiles. If services (notably Mapbox's) really violate the HTTP spec. this should be a separate issue.

springmeyer commented 5 years ago

Ran into this old issue, which is resolved by https://github.com/mapbox/mbtiles-spec/blob/master/1.3/spec.md#content. Note: above there is mention of deflate compression, but actually vector tiles are expected to be encoded with gzip coding rather than pure deflate coding (see https://github.com/ebiggers/libdeflate#deflate-vs-zlib-vs-gzip for the differences).