Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ENH: New geoaccessor to_h3 to convert geometry to h3 index #739

Merged
merged 72 commits into from
Dec 11, 2022
Merged

Conversation

Zeroto521
Copy link
Owner

@Zeroto521 Zeroto521 commented Oct 14, 2022

  • closes #xxxx
  • whatsnew entry
    >>> import dtoolkit.geoaccessor
    >>> import pandas as pd

    Points to h3 indexes.

    >>> s = pd.Series(
    ...     [
    ...         "POINT (122 55)",
    ...         "POINT (100 1)",
    ...     ],
    ... ).from_wkt(crs=4326, drop=True)
    >>> s
    0    POINT (122.00000 55.00000)
    1     POINT (100.00000 1.00000)
    dtype: geometry
    >>> s.to_h3(8)
    0    612845052823076863
    1    614269156845420543
    dtype: int64

@Zeroto521 Zeroto521 changed the title ENH: New accessor for GeoPandas to convert geometry to h3 index ENH: New accessor for GeoPandas to convert geometry to h3 index, to_h3 Dec 11, 2022
@Zeroto521 Zeroto521 changed the title ENH: New accessor for GeoPandas to convert geometry to h3 index, to_h3 ENH: New geoaccessor to_h3 to convert geometry to h3 index Dec 11, 2022
@Zeroto521 Zeroto521 merged commit 95618ef into main Dec 11, 2022
@Zeroto521 Zeroto521 deleted the to_h3 branch December 11, 2022 09:20
@Zeroto521
Copy link
Owner Author

Advices for h3-pandas

  1. use import h3.api.numpy_int as h3 instead of import h3
  2. compat with h3-py 4
  3. requires crs is 4326
  4. consider h3-py as the accessor of Series
  5. Speed up creating points / polygons via shapely 2.x

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant