Skip to content

fix(core): support geopandas >= 1 / pyogrio for GeoDataFrame save and load - #805

Open
Pranava-Kumar wants to merge 2 commits into
sentinel-hub:developfrom
Pranava-Kumar:fix/pyogrio-geopandas-compat
Open

fix(core): support geopandas >= 1 / pyogrio for GeoDataFrame save and load#805
Pranava-Kumar wants to merge 2 commits into
sentinel-hub:developfrom
Pranava-Kumar:fix/pyogrio-geopandas-compat

Conversation

@Pranava-Kumar

@Pranava-Kumar Pranava-Kumar commented Jul 13, 2026

Copy link
Copy Markdown

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._save to write to a temporary .gpkg file first.

2. Load (read) path:

  • pyogrio warns about non-conformant file extension when reading GPKG from virtual in-memory files (/vsimem/). Suppressed the harmless warning.
  • Use GeoDataFrame.set_crs() instead of direct attribute assignment to avoid a deprecation warning in newer geopandas versions.

Changes

  • eolearn/core/eodata_io.py:
    • Override FeatureIOGeoDf._save for pyogrio-compatible compressed/uncompressed GPKG saves
    • Suppress pyogrio RuntimeWarning in _read_from_file
    • Fix CRS deprecation warning with set_crs()
  • pyproject.toml: Remove <1 upper bound on geopandas

Testing

  • 744 core tests pass (all 22 IO tests without warnings)
  • Tested with geopandas 1.1.4 and pyogrio 0.13.0
  • Pre-existing failures (Windows-only) are unrelated

Related issue

Closes #803

…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
@Pranava-Kumar Pranava-Kumar changed the title fix(core): support geopandas >= 1 by writing GeoDataFrames to real file paths fix(core): support geopandas >= 1 / pyogrio for GeoDataFrame save and load Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant