-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compression #27
Comments
Compression should always happen at the transportation/storage layer. Do you have an example of a PBF in the wild that is served compressed? |
quoting @ajashton when I sent him an uncompressed tile
cc @zerebubuth |
mapbox/tilelive-vector#71 (comment) and mapbox/tilelive-bridge#21 (comment) both suggest that the tiles should be compressed, even at rest on a plain disk. |
Yeah, but the Spec doesn't provide a storage facility, so it is up to the storage mechanisms to transparently compress/decompress the data. |
What's confusing me is whether this should be happening at the transport (or storage) layer, as @kkaefer is saying, or is an intrinsic part of being a "mapnik vector tile" as @jfirebaugh is saying. If it's handled at the transport layer, then an HTTP request for a mapnik vector tile which specifies no Accept-Encoding (or "Accept-Encoding: identity") should receive an uncompressed PBF. If it's intrinsic, then it should receive a gzip compressed PBF, despite still having "Encoding: identity". |
The conventions are at the API level, not the specification level, and are driven by pragmatic constraints:
Together, these constraints led to the current solution: vector tiles are gzipped at rest, and served with Content-Encoding: gzip for HTTP transport. Browser user agents will automatically decompress HTTP bodies, satisfying #2. Non-browser user agents typically do not automatically decompress HTTP bodies, satisfying #3. This means:
|
cc @yohanboniface, as another author of vector tile consuming software Leaving aside the storage what you're saying is vector tiles are uncompressed, but
Is this correct? On-disk storage is an interesting question, as what is optimal can depend on the filesystem, the disks, and what is consuming the tiles. |
FWIW we ran into this issue recently when @ericfischer was trying to use the Mapzen vector tiles in Mapbox Studio. We were serving gzipped tiles when |
Serving gzip if Accept-Encoding is not specified is okay. The HTTP spec says servers should use identity in such cases, not must. Serving gzip if identity is requested is broken. I must admit that I haven't looked at the MBS HTTP requests - does it currently send an accept-encoding header which disallows identity encoding? |
I cannot recall offhand, I believe no Accept-Encoding was present, I'm sure a Mapboxer here could say :) |
Currently we do not have any text in version 2.0 pull request about compression, but I feel we should likely add something at least describing it? I understand that it is often dealt with on a transport level by the browsers, but for server side processing in the wild there are a variety of compressed and uncompressed tiles. If anyone would like to create a pull request to the v2-development branch with these changes it would be GREATLY appreciated. |
It matters when you are making |
I'm actually happy with how the spec is silent on compression. A m-v-t file is not compressed. It is often useful to compress m-v-t when storing them, but then you have a compressed m-v-t file, not a m-v-t file. Analogously, planet-latest.osm.bz2 is bzipped XML, not just XML. With transport-level compression and HTTP the content is uncompressed, and the gzip encoded content is compressed. Specifications for storage (e.g. mbtiles, disk layouts, etc) should address if the tiles have compression applied to them.
The m-v-t spec doesn't address uploading, just the format of a single vector tile. As it stands, mbtiles cannot store vector tiles, only png or jpg #39 proposes language which is clearer on the vector tile being different than the system that encodes its bounds and projection (TMS numbering, google maps tile numbers, etc) |
@ericfischer, I agree with @pnorman in that the respective storage formats/APIs should handle compression, not the vector tile spec. |
Sounds good to me to address this in the mbtiles spec instead. |
All of this sounds great to me! We probably should encourage the use of |
yes, if storing gzipped mvts, .mvt.gz makes sense for a filename. |
Have we reached a general agreement around this, if so I am going to close the ticket to mark this task as closed. |
Yes. |
Currently the specification does not allow compression, but some PBFs seen in the wild are compressed, and not at the transport layer (HTTP).
The specification should be explicit on if compression is allowed.
The text was updated successfully, but these errors were encountered: