You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "yunchipang (via GitHub)" <gi...@apache.org> on 2025/10/13 23:56:20 UTC
[PR] [GH-2394] Implement `symmetric_difference` [sedona]
yunchipang opened a new pull request, #2395:
URL: https://github.com/apache/sedona/pull/2395
## Did you read the Contributor Guide?
- Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/)
## Is this PR related to a ticket?
- Yes, and the PR name follows the format `[GH-XXX] my subject`. Closes #2394
## What changes were proposed in this PR?
Implements `symmetric_difference`
## How was this patch tested?
Tests added
## Did this PR include necessary documentation updates?
- Yes, I have updated the documentation.
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [GH-2394] Implement `symmetric_difference` [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #2395:
URL: https://github.com/apache/sedona/pull/2395
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [GH-2394] Implement `symmetric_difference` [sedona]
Posted by "yunchipang (via GitHub)" <gi...@apache.org>.
yunchipang commented on code in PR #2395:
URL: https://github.com/apache/sedona/pull/2395#discussion_r2427699991
##########
python/tests/geopandas/test_match_geopandas_series.py:
##########
@@ -564,6 +564,33 @@ def test_difference(self):
)
self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+ def test_symmetric_difference(self):
+ for geom, geom2 in self.pairs:
+ # Sedona doesn't support difference for GeometryCollections
+ if isinstance(geom[0], GeometryCollection) or isinstance(
+ geom2[0], GeometryCollection
+ ):
+ continue
+ # Operation doesn't work on invalid geometries
+ if (
+ not gpd.GeoSeries(geom).is_valid.all()
+ or not gpd.GeoSeries(geom2).is_valid.all()
+ ):
+ continue
Review Comment:
gotcha. thanks!
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [GH-2394] Implement `symmetric_difference` [sedona]
Posted by "petern48 (via GitHub)" <gi...@apache.org>.
petern48 commented on code in PR #2395:
URL: https://github.com/apache/sedona/pull/2395#discussion_r2427688611
##########
python/tests/geopandas/test_match_geopandas_series.py:
##########
@@ -564,6 +564,33 @@ def test_difference(self):
)
self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+ def test_symmetric_difference(self):
+ for geom, geom2 in self.pairs:
+ # Sedona doesn't support difference for GeometryCollections
+ if isinstance(geom[0], GeometryCollection) or isinstance(
+ geom2[0], GeometryCollection
+ ):
+ continue
+ # Operation doesn't work on invalid geometries
+ if (
+ not gpd.GeoSeries(geom).is_valid.all()
+ or not gpd.GeoSeries(geom2).is_valid.all()
+ ):
+ continue
Review Comment:
(This one is just for your knowledge) In general, we want all cases to pass. This condition here is a case that we want to keep because it raises the following error, making our test fail.
```
E shapely.errors.GEOSException: TopologyException: side location conflict at 1.5 0.5. This can occur if the input geometry is invalid.
```
This also means that if you implement a function test in the future that fails for odd reasons (unrelated to the Python Sedona geopandas code), you can write a conditional skip like this to avoid it, too. If you're unsure whether it's reasonable, you're always welcome to ask for help.
##########
python/tests/geopandas/test_match_geopandas_series.py:
##########
@@ -564,6 +564,33 @@ def test_difference(self):
)
self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+ def test_symmetric_difference(self):
+ for geom, geom2 in self.pairs:
+ # Sedona doesn't support difference for GeometryCollections
+ if isinstance(geom[0], GeometryCollection) or isinstance(
+ geom2[0], GeometryCollection
+ ):
+ continue
Review Comment:
```suggestion
```
We can delete this. (I tried it locally, and it passes). The reason that `difference` had this skip is because there's a bug in the Java code that throws an error for Geom Collection. Fixing it was out-of-scope for a geopandas PR. In this case, we can remove this because symmetric_difference doesn't have this problem. I ran it myself locally and it passed.
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [GH-2394] Implement `symmetric_difference` [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #2395:
URL: https://github.com/apache/sedona/pull/2395#issuecomment-3400037861
Great work. Thank you!
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org