Repository navigation
Conversation
Tiles are always gzipped at the fast level 1. A new gzip_level option (0-9) in R and Python freestile(), and TileConfig::gzip_level in the core, sets the level for the in-memory pipeline. None keeps level 1, so existing output is unchanged; other levels change only the compression, never the decompressed tiles. Out-of-range levels are refused before any output is written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 13, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tile data is always gzipped at the fast level 1. That's a good default for build time, but for archives that are built once and served many times, a higher level gives a smaller file for a one-time cost. This adds a
gzip_leveloption (0-9) tofreestile()in R and Python. The default is unchanged, so existing output is byte-identical. Other levels change only the compression: the decompressed tiles are identical.TileConfig::gzip_level: Option<u32>(None= level 1) andpmtiles_writer::gzip_compress_level().gzip_compress()keeps its signature and behavior. Levels above 9 are refused before any output is written.freestile(gzip_level = NULL), validated as a whole number from 0 to 9 and passed torust_freestile(). The Rd files andextendr-wrappers.Rare updated by hand to match the new argument.freestile(gzip_level=None), which rejects non-integers, booleans and out-of-range values.gzip_leveltogether with categorical clustering, which writes through its own path.freestile_file(),freestile_query()and the streaming writer passNoneand are unchanged. Exposing the option there too is a small follow-up if you want it everywhere.Measured with Python on synthetic data (the best of 3 runs; Windows, 8 cores, a shared machine, so the times are approximate):
cell_id+ one float columnThe point timings varied by more than the level effect on this machine, so I left them out. Level 6 looks like the useful setting; level 9 adds little size reduction for the extra time.
Validation:
tests/gzip_level.rs, added as a CI step. It checks level round trips and bounds, that level 9 makes a smaller archive with identical decompressed tiles, and that level 12 is refused with no file written.test-gzip-level.R: level 9 is smaller than the default onnc, and -1, 10, 2.5,"6",NAandc(1, 2)are rejected without writing output. Built from source (R 4.6.1, Rtools45, CRAN feature set). Fulltestthatsuite: 0 failures (the skips are DuckDB/GeoParquet tests the CRAN build doesn't include).test_gzip_level.py: smaller archive with identical decompressed tiles, rejection of -1, 10, 2.5,Trueand"6", and refusal with categorical clustering. Full suite passes (wheel built with--no-default-features --features geoparquet, so the DuckDB tests skip).freestiler-core, because the crate's dev-dependencymlt-core->fastpforcan't download CPM.cmake on my machine (TLS error). The CI step runs it directly. The streaming unit tests (--features duckdb) gain the new field. I couldn't build those locally, so CI or a localcargo test --features duckdbshould confirm they compile.I prepared this change with AI assistance (Claude Code) and reviewed it before submitting.