fix(core): support geopandas >= 1 / pyogrio for GeoDataFrame save and load - #805
Open
Pranava-Kumar wants to merge 2 commits into
Open
fix(core): support geopandas >= 1 / pyogrio for GeoDataFrame save and load#805Pranava-Kumar wants to merge 2 commits into
Pranava-Kumar wants to merge 2 commits into
Conversation
…le paths Geopandas >= 1 uses pyogrio as the default I/O engine, which requires a real file path for GPKG format and cannot write to open file handles or gzip-wrapped file objects. This overrides FeatureIOGeoDf._save to first write the GeoDataFrame to a temporary .gpkg file, then copy (and optionally gzip-compress) the content to the target filesystem. Closes sentinel-hub#803
…r feature loading - Suppress pyogrio RuntimeWarning when reading GPKG from virtual in-memory files (no .gpkg extension in vsimem path) - Use GeoDataFrame.set_crs() instead of direct attribute assignment to avoid deprecation warning in newer geopandas versions
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.
Summary
Fix incompatibility with geopandas >= 1 (closes #803). Geopandas >= 1 uses pyogrio as the default I/O engine for GPKG format. This PR addresses two issues:
1. Save (write) path: pyogrio requires a real file path for GPKG and cannot write to open file handles or gzip-wrapped file objects. Overrode
FeatureIOGeoDf._saveto write to a temporary.gpkgfile first.2. Load (read) path:
/vsimem/). Suppressed the harmless warning.GeoDataFrame.set_crs()instead of direct attribute assignment to avoid a deprecation warning in newer geopandas versions.Changes
eolearn/core/eodata_io.py:FeatureIOGeoDf._savefor pyogrio-compatible compressed/uncompressed GPKG saves_read_from_fileset_crs()pyproject.toml: Remove<1upper bound on geopandasTesting
Related issue
Closes #803