Repository: Zeroto521/my-data-toolkit

Issue:
ENH: New geoaccessor to calculate two coordinates distance on earth
<!--
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
- [ ] whatsnew entry



Discussion:
# [Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/699?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25) Report
> Merging [#699](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/699?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25) (3e2fbea) into [main](https://codecov.io/gh/Zeroto521/my-data-toolkit/commit/85ec5cf81287fbd41cd5e36955459bf9fd0ffaa6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25) (85ec5cf) will **decrease** coverage by `0.12%`.
> The diff coverage is `100.00%`.

```diff
@@            Coverage Diff             @@
##             main     #699      +/-   ##
==========================================
- Coverage   99.55%   99.43%   -0.13%     
==========================================
  Files         116      118       +2     
  Lines        1361     1404      +43     
  Branches      123      128       +5     
==========================================
+ Hits         1355     1396      +41     
- Misses          1        2       +1     
- Partials        5        6       +1     
```


| [Impacted Files](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/699?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25) | Coverage Δ | |
|---|---|---|
| [...oolkit/geoaccessor/geoseries/geodistance\_matrix.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2Vvc2VyaWVzL2dlb2Rpc3RhbmNlX21hdHJpeC5weQ==) | `100.00% <ø> (ø)` | |
| [dtoolkit/geoaccessor/geodataframe/\_\_init\_\_.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/699/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%> (ø)` | |
| [dtoolkit/geoaccessor/geodataframe/geodistance.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2VvZGF0YWZyYW1lL2dlb2Rpc3RhbmNlLnB5) | `100.00% <100.00%> (ø)` | |
| [dtoolkit/geoaccessor/geoseries/\_\_init\_\_.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/699/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%> (ø)` | |
| [dtoolkit/geoaccessor/geoseries/geodistance.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvZ2VvYWNjZXNzb3IvZ2Vvc2VyaWVzL2dlb2Rpc3RhbmNlLnB5) | `100.00% <100.00%> (ø)` | |
| [dtoolkit/transformer/sklearn/OneHotEncoder.py](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=40%25#diff-ZHRvb2xraXQvdHJhbnNmb3JtZXIvc2tsZWFybi9PbmVIb3RFbmNvZGVyLnB5) | `92.30% <0.00%> (-7.70%)` | :arrow_down: |

: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/geoseries/geodistance.py b/dtoolkit/geoaccessor/geoseries/geodistance.py
--- a/dtoolkit/geoaccessor/geoseries/geodistance.py
+++ b/dtoolkit/geoaccessor/geoseries/geodistance.py
@@ -129,8 +129,9 @@ def geodistance(
     else:
         raise TypeError(f"Unknown type: {type(other).__name__!r}.")
 
+    x1, y1 = s.x.to_numpy(), s.y.to_numpy()
     return pd.Series(
-        radius * haversine(s.x.to_numpy(), s.y.to_numpy(), x2, y2),
+        radius * haversine(x1, y1, x2, y2),
         index=s.index,
     )
 
diff --git a/dtoolkit/geoaccessor/geoseries/geodistance_matrix.py b/dtoolkit/geoaccessor/geoseries/geodistance_matrix.py
--- a/dtoolkit/geoaccessor/geoseries/geodistance_matrix.py
+++ b/dtoolkit/geoaccessor/geoseries/geodistance_matrix.py
@@ -4,6 +4,7 @@
 import numpy as np
 import pandas as pd
 
+from dtoolkit.geoaccessor.geoseries.xy import xy
 from dtoolkit.geoaccessor.register import register_geoseries_method
 
 
@@ -114,11 +115,11 @@ def geodistance_matrix(
         if other.crs != 4326:
             raise ValueError(f"Only support 'EPSG:4326' CRS, but got {other.crs!r}.")
 
-        Y = np.radians(np.stack((other.geometry.y, other.geometry.x), axis=1))
+        Y = np.radians(xy(other.geometry, reverse=True).tolist())
     else:
         raise TypeError(f"Unknown type: {type(other).__name__!r}.")
 
-    X = np.radians(np.stack((s.y, s.x), axis=1))
+    X = np.radians(xy(s, reverse=True).tolist())
     return pd.DataFrame(
         radius * haversine_distances(X, Y),
         index=s.index,


Test patch: