Restore compatibility with rasterio >= 1.3#48
Open
wboykinm wants to merge 1 commit into
Open
Conversation
The mbtiler path relied on three rasterio APIs that have since been removed or tightened: - rasterio._io.virtual_file_to_buffer is private and was removed; use the public rasterio.io.MemoryFile instead. - The "affine" profile key was deprecated in rasterio 1.0 in favor of "transform". - transform_bounds(..., densify_pts=0) is rejected when the destination CRS is geographic; use the default densification. Also drops a brittle byte-length assertion in test_webp_writer; the exact webp byte count varies across libwebp/Pillow versions and the adjacent relative comparison still covers the intent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Fixes #39
Summary
The mbtiler path no longer ran on current rasterio (tested against 1.4.4). Three API breaks fixed:
rasterio._io.virtual_file_to_bufferwas a private API and has been removed. Switched_encode_as_pngto the publicrasterio.io.MemoryFile.affineprofile key was deprecated in rasterio 1.0 in favor oftransform. It was being silently ignored, so output PNG tiles had no transform set.transform_bounds(..., densify_pts=0)is now rejected when the destination CRS is geographic (densify_pts must be at least 2 if the output is geograpic). Dropped the override; rasterio's default (21) is appropriate here.Also dropped a brittle
assert len(test_bytearray) == 34intest_webp_writer— the exact webp byte count varies across libwebp / Pillow versions (currently 42 with Pillow 10), and the relative comparison right after it (complex data encodes larger than zero-data) still covers the intent.Test plan
pytest— 19/19 pass againstrasterio==1.4.4,Pillow==10.x, Python 3.10test/fixtures/elev.tif: