jiayuasu opened a new issue, #3132: URL: https://github.com/apache/sedona/issues/3132
Part of #2230. ## Summary Implement the closely related GeoJSON interface methods that are currently missing from Sedona's GeoPandas-compatible API: - `GeoDataFrame.iterfeatures` - `GeoDataFrame.to_geo_dict` - `GeoDataFrame.__geo_interface__` - `GeoSeries.__geo_interface__` These methods should follow GeoPandas behavior while using Sedona's existing `to_geopandas()` materialization boundary. As with the current `to_json`, `to_arrow`, and `plot` implementations, this functionality will collect data to the driver and should be documented accordingly. ## Requirements - Support `iterfeatures(na="null", show_bbox=False, drop_id=False)` argument semantics. - Return GeoPandas-compatible feature dictionaries, identifiers, bounding boxes, and null handling. - Keep `to_geo_dict` and both `__geo_interface__` properties consistent with `iterfeatures`. - Preserve index values in feature identifiers unless `drop_id=True`. - Handle null geometries, empty geometries, mixed geometry types, and CRS-bearing inputs. - Add no new mandatory dependency. ## Version compatibility The Python 3.8 environment resolves GeoPandas 0.13.2, which does not provide `GeoDataFrame.to_geo_dict`. The implementation should supply a behavior-compatible fallback instead of skipping this API on Python 3.8. Newer environments should match their installed GeoPandas behavior. ## Tests Add direct and parity coverage for: - default, named, and non-string indexes; - `drop_id=True` and `drop_id=False`; - `show_bbox=True` and `show_bbox=False`; - `na="null"`, `na="drop"`, and `na="keep"`; - null and empty geometries; - mixed geometry types; - CRS-bearing GeoDataFrames; - GeoDataFrame and GeoSeries `__geo_interface__` output; - the GeoPandas 0.13.2 fallback path. ## Likely files - `python/sedona/spark/geopandas/geodataframe.py` - `python/sedona/spark/geopandas/geoseries.py` - `python/tests/geopandas/test_geodataframe.py` - `python/tests/geopandas/test_match_geopandas_dataframe.py` - `python/tests/geopandas/test_geoseries.py` - `python/tests/geopandas/test_match_geopandas_series.py` ## Acceptance criteria - All four APIs are implemented and documented. - Supported arguments and edge cases match GeoPandas behavior. - Python 3.8 with GeoPandas 0.13.2 remains supported. - Focused tests and the relevant Python matrix pass. - The implementation PR references `Part of #2230` and does not close the epic. ## Non-goals - A distributed or streaming GeoJSON iterator. - Changes to JVM or SQL geometry functions. - Implementing `to_file`, `clip`, `overlay`, or other unrelated GeoPandas APIs. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
