Skip to content

[GH-2149] Geopandas: Implement to_file, from_file, read_file - #2150

Merged
jiayuasu merged 6 commits into
apache:masterfrom
petern48:to_file
Jul 26, 2025
Merged

jiayuasu merged 6 commits into
apache:masterfrom
petern48:to_file

Conversation

@petern48

Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

  • Implement to_file, from_file, read_file
  • Fix GeoDataFrame.getitem to handle non-int indexes properly

How was this patch tested?

Added tests

Did this PR include necessary documentation updates?

  • Yes, I have updated the documentation.

@petern48
petern48 marked this pull request as ready for review July 24, 2025 06:07
@petern48
petern48 requested a review from jiayuasu as a code owner July 24, 2025 06:07
@petern48
petern48 requested a review from zhangfengcdt July 24, 2025 06:07
@jiayuasu
jiayuasu requested a review from Copilot July 24, 2025 06:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the to_file, from_file, and read_file functions for the Geopandas compatibility layer in Sedona, enabling file I/O operations for GeoDataFrames and GeoSeries. The implementation adds support for multiple geospatial file formats including GeoJSON, GeoParquet, Shapefile, and GeoPackage.

Key changes:

  • Added comprehensive I/O functionality with automatic format detection
  • Fixed GeoDataFrame.getitem to handle non-integer indexes properly
  • Modified buffer method to return GeoSeries instead of GeoDataFrame for consistency

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
python/sedona/geopandas/io.py New module implementing core file I/O functionality with format detection and validation
python/sedona/geopandas/geodataframe.py Added from_file/to_file methods, fixed getitem index handling, and updated buffer return type
python/sedona/geopandas/geoseries.py Added from_file/to_file methods and updated _to_geoframe method
python/tests/geopandas/test_io.py Comprehensive test suite covering all supported file formats and edge cases
python/tests/geopandas/test_geopandas_base.py Added utility methods for index comparison in tests
python/tests/geopandas/test_geodataframe.py Updated buffer test to match new return type
python/tests/geopandas/test_match_geopandas_series.py Removed outdated test method
python/sedona/geopandas/init.py Exported read_file function

Comment thread python/sedona/geopandas/io.py Resolved
Comment thread python/sedona/geopandas/io.py Resolved
Comment thread python/sedona/geopandas/io.py Resolved
Comment thread python/sedona/geopandas/geoseries.py Resolved
Comment thread python/sedona/geopandas/geodataframe.py Resolved
Comment thread python/sedona/geopandas/geodataframe.py Resolved
Comment thread python/sedona/geopandas/io.py Resolved
Comment thread python/sedona/geopandas/geodataframe.py Resolved
Comment thread python/sedona/geopandas/io.py Resolved
@jiayuasu jiayuasu added this to the sedona-1.8.0 milestone Jul 26, 2025
@jiayuasu
jiayuasu merged commit 3863962 into apache:master Jul 26, 2025
@petern48
petern48 deleted the to_file branch July 27, 2025 05:03
Kontinuation pushed a commit to Kontinuation/sedona that referenced this pull request Jan 21, 2026
…le` (apache#2150)

* Implement to_file, from_file, read_file

* Fix ci

* Delete __repr__()'s and _process_geometry_columnsi and PR feedback

* Make format and extension case insensitive in read_file

* Remove sort by GeoHash logic in to_file parquet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Geopandas: Implement to_file, from_file, read_file

4 participants