Repository: Zeroto521/my-data-toolkit

Issue:
ENH: New geoaccessor to filter geometry via spatial relationship
<!--
Thanks for contributing a pull request!

Please follow these standard acronyms to start the commit message:

- ENH: enhancement
- BUG: bug fix
- DOC: documentation
- TYP: type annotations
- TST: addition or modification of tests
- MAINT: maintenance commit (refactoring, typos, etc.)
- BLD: change related to building
- REL: related to releasing
- API: an (incompatible) API change
- DEP: deprecate something, or remove a deprecated object
- DEV: development tool or utility
- REV: revert an earlier commit
- PERF: performance improvement
- BOT: always commit via a bot
- CI: related to CI or CD
- CLN: Code cleanup
-->

- [ ] closes #xxxx
- [x] whatsnew entry

A sugar syntax wraps for `s[s.contains(geometry, **kwargs)]`


Discussion:
# [Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25) Report
> Merging [#691](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25) (6bcf16d) into [main](https://codecov.io/gh/Zeroto521/my-data-toolkit/commit/0843dced6c41da2299ed0620d3884ff81233e363?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25) (0843dce) will **increase** coverage by `0.01%`.
> The diff coverage is `100.00%`.

```diff
@@            Coverage Diff             @@
##             main     #691      +/-   ##
==========================================
+ Coverage   99.53%   99.55%   +0.01%     
==========================================
  Files         112      114       +2     
  Lines        1302     1334      +32     
  Branches      120      121       +1     
==========================================
+ Hits         1296     1328      +32     
  Misses          1        1              
  Partials        5        5              
```


| [Impacted Files](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25) | Coverage Δ | |
|---|---|---|
| [dtoolkit/accessor/series/dropna\_index.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvYWNjZXNzb3Ivc2VyaWVzL2Ryb3BuYV9pbmRleC5weQ==) | `100.00% <ø> (ø)` | |
| [dtoolkit/accessor/series/set\_unique\_index.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvYWNjZXNzb3Ivc2VyaWVzL3NldF91bmlxdWVfaW5kZXgucHk=) | `100.00% <ø> (ø)` | |
| [dtoolkit/accessor/dataframe/set\_unique\_index.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvYWNjZXNzb3IvZGF0YWZyYW1lL3NldF91bmlxdWVfaW5kZXgucHk=) | `100.00% <100.00%> (ø)` | |
| [dtoolkit/geoaccessor/geodataframe/\_\_init\_\_.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2VvZGF0YWZyYW1lL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | |
| [...lkit/geoaccessor/geodataframe/count\_coordinates.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2VvZGF0YWZyYW1lL2NvdW50X2Nvb3JkaW5hdGVzLnB5) | `100.00% <100.00%> (ø)` | |
| [...oolkit/geoaccessor/geodataframe/filter\_geometry.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2VvZGF0YWZyYW1lL2ZpbHRlcl9nZW9tZXRyeS5weQ==) | `100.00% <100.00%> (ø)` | |
| [dtoolkit/geoaccessor/geodataframe/geobuffer.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2VvZGF0YWZyYW1lL2dlb2J1ZmZlci5weQ==) | `100.00% <100.00%> (ø)` | |
| [...oolkit/geoaccessor/geodataframe/get\_coordinates.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2VvZGF0YWZyYW1lL2dldF9jb29yZGluYXRlcy5weQ==) | `100.00% <100.00%> (ø)` | |
| [dtoolkit/geoaccessor/geodataframe/toposimplify.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2VvZGF0YWZyYW1lL3RvcG9zaW1wbGlmeS5weQ==) | `100.00% <100.00%> (ø)` | |
| [dtoolkit/geoaccessor/geoseries/\_\_init\_\_.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2Vvc2VyaWVzL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | |
| ... and [5 more](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/691/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25) | |

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25)


Resolving patch:
diff --git a/dtoolkit/geoaccessor/geodataframe/filter_geometry.py b/dtoolkit/geoaccessor/geodataframe/filter_geometry.py
--- a/dtoolkit/geoaccessor/geodataframe/filter_geometry.py
+++ b/dtoolkit/geoaccessor/geodataframe/filter_geometry.py
@@ -20,7 +20,7 @@
 def filter_geometry(
     df: gpd.GeoDataFrame,
     /,
-    geometry: BaseGeometry | gpd.GeoSeries | gpd.GeoDataFrame,
+    other: BaseGeometry | gpd.GeoSeries | gpd.GeoDataFrame,
     predicate: BINARY_PREDICATE,
     complement: bool = False,
     **kwargs,
@@ -29,7 +29,7 @@ def filter_geometry(
     return df[
         _filter_geometry(
             df,
-            geometry=geometry,
+            other=other,
             predicate=predicate,
             complement=complement,
             **kwargs,
diff --git a/dtoolkit/geoaccessor/geoseries/filter_geometry.py b/dtoolkit/geoaccessor/geoseries/filter_geometry.py
--- a/dtoolkit/geoaccessor/geoseries/filter_geometry.py
+++ b/dtoolkit/geoaccessor/geoseries/filter_geometry.py
@@ -33,7 +33,7 @@
 def filter_geometry(
     s: gpd.GeoSeries,
     /,
-    geometry: BaseGeometry | gpd.GeoSeries | gpd.GeoDataFrame,
+    other: BaseGeometry | gpd.GeoSeries | gpd.GeoDataFrame,
     predicate: BINARY_PREDICATE,
     complement: bool = False,
     **kwargs,
@@ -43,11 +43,11 @@ def filter_geometry(
 
     A sugar syntax wraps::
 
-        s[s.{{predicate}}(geometry, **kwargs)]
+        s[s.{{predicate}}(other, **kwargs)]
 
     Parameters
     ----------
-    geometry : Geometry, GeoSeries, or GeoDataFrame
+    other : Geometry, GeoSeries, or GeoDataFrame
 
     predicate : {{"intersects", "disjoint", "crosses", "overlaps", "touches", \
 "covered_by", "contains", "within", "covers"}}
@@ -102,8 +102,8 @@ def filter_geometry(
 
     This method is actually faster than the following one::
 
-        def is_in_geometry(s: gpd.GeoSeries, geometry: BaseGeometry) -> pd.Series:
-            s_bounds, g_bounds = s.bounds, geometry.bounds
+        def is_in_geometry(s: gpd.GeoSeries, other: BaseGeometry) -> pd.Series:
+            s_bounds, g_bounds = s.bounds, other.bounds
 
             return (
                 (s_bounds.minx >= g_bounds[0])
@@ -116,7 +116,7 @@ def is_in_geometry(s: gpd.GeoSeries, geometry: BaseGeometry) -> pd.Series:
     return s[
         _filter_geometry(
             s,
-            geometry=geometry,
+            other=other,
             predicate=predicate,
             complement=complement,
             **kwargs,
@@ -126,7 +126,7 @@ def is_in_geometry(s: gpd.GeoSeries, geometry: BaseGeometry) -> pd.Series:
 
 def _filter_geometry(
     s: gpd.GeoSeries,
-    geometry: BaseGeometry | gpd.GeoSeries | gpd.GeoDataFrame,
+    other: BaseGeometry | gpd.GeoSeries | gpd.GeoDataFrame,
     predicate: BINARY_PREDICATE,
     complement: bool,
     **kwargs,
@@ -136,5 +136,5 @@ def _filter_geometry(
             f"Got {predicate=!r}, expected one of {get_args(BINARY_PREDICATE)!r}.",
         )
 
-    mask = getattr(s, predicate)(geometry, **kwargs)
+    mask = getattr(s, predicate)(other, **kwargs)
     return ~mask if complement else mask


Test patch:
diff --git a/test/geoaccessor/geoseries/test_filter_geometry.py b/test/geoaccessor/geoseries/test_filter_geometry.py
--- a/test/geoaccessor/geoseries/test_filter_geometry.py
+++ b/test/geoaccessor/geoseries/test_filter_geometry.py
@@ -25,7 +25,7 @@ def test_error():
 
 
 @pytest.mark.parametrize(
-    "s, geometry, predicate, complement, expected",
+    "s, other, predicate, complement, expected",
     [
         (
             gpd.GeoSeries(
@@ -81,9 +81,9 @@ def test_error():
         ),
     ],
 )
-def test_work(s, geometry, predicate, complement, expected):
+def test_work(s, other, predicate, complement, expected):
     result = s.filter_geometry(
-        geometry=geometry,
+        other=other,
         predicate=predicate,
         complement=complement,
     )