jiayuasu opened a new issue, #3269:
URL: https://github.com/apache/sedona/issues/3269
## Expected behavior
Sedona's distributed GeoPandas compatibility layer should match GeoPandas
when
binary equality predicates compare geometry columns with different coordinate
reference systems.
`GeoSeries.geom_equals` and `GeoSeries.geom_equals_exact` should emit one CRS
mismatch warning for GeoSeries, GeoDataFrame, or pandas-on-Spark Series
operands whose CRS values differ, while still returning the row-wise
predicate
result. The corresponding GeoDataFrame methods should behave the same through
their active geometry columns.
Matching CRS values and scalar Shapely geometry operands should not emit this
warning. The warning should point to the user's call site.
This is consistent with GeoPandas and with the newer distributed
`shared_paths` and `geom_equals_identical` implementations.
## Actual behavior
`geom_equals` and `geom_equals_exact` currently perform the comparison
without
checking the two geometry columns' CRS metadata. They therefore return
results
silently when their operands have different CRS values.
The methods' existing alignment warnings are unrelated and do not identify
the
CRS mismatch.
## Steps to reproduce
```python
import warnings
from shapely.geometry import Point
from sedona.spark.geopandas import GeoSeries
left = GeoSeries([Point(0, 0)], crs="EPSG:4326")
right = GeoSeries([Point(0, 0)], crs="EPSG:3857")
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
left.geom_equals(right, align=False)
assert not any("CRS mismatch" in str(item.message) for item in caught)
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
left.geom_equals_exact(right, tolerance=0, align=False)
assert not any("CRS mismatch" in str(item.message) for item in caught)
```
For comparison, equivalent GeoPandas calls warn that the left and right CRS
differ.
## Suggested scope
- Reuse the compatibility layer's shared CRS mismatch warning helper for both
predicates before Series alignment.
- Emit exactly one warning for GeoSeries, GeoDataFrame, and pandas-on-Spark
Series operands with different CRS values.
- Preserve current scalar geometry behavior without a CRS warning.
- Preserve existing row alignment, result values, and null behavior.
- Add GeoPandas parity tests covering mismatched and matching CRS values and
assert that warning attribution reaches the user call site.
Part of #2230.
## Sedona version
2.0.0-SNAPSHOT
## Apache Spark version
All supported versions; this is GeoPandas compatibility-layer behavior.
## API type
Python
## Python version
All supported versions.
## Environment
Sedona distributed GeoPandas API.
## Existing issues
- [x] I searched the existing issues and did not find a duplicate.
--
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]