v0.0.20rc1
Pre-release
Pre-release
github-actions
released this
28 Dec 13:11
·
66 commits
to main
since this release
Highlights of this release
Hightly support H3 (Hexagonal hierarchical geospatial indexing system) via .to_h3
and .H3.*
.
>>> import dtoolkit.geoaccessor
>>> import pandas as pd
>>> df = pd.DataFrame({"x": [122, 100], "y": [55, 1]}).from_xy('x', 'y', crs=4326)
>>> df
x y geometry
0 122 55 POINT (122.00000 55.00000)
1 100 1 POINT (100.00000 1.00000)
# GeoDataFrame -> h3 cell
>>> df_with_h3 = df.to_h3(8)
>>> df_with_h3
x y geometry
612845052823076863 122 55 POINT (122.00000 55.00000)
614269156845420543 100 1 POINT (100.00000 1.00000)
# Calculate h3 cell area
>>> df_with_h3.h3.area
612845052823076863 710781.770906
614269156845420543 852134.191671
dtype: float64
# h3 cell -> GeoDataFrame
>>> df_parent_cell = df_with_h3.h3.to_parent()
>>> df_parent_cell
x y geometry
608341453197803519 122 55 POINT (122.00000 55.00000)
609765557230632959 100 1 POINT (100.00000 1.00000)
>>> df_parent_cell.h3.to_points()
x y geometry
608341453197803519 122 55 POINT (122.00991 55.00606)
609765557230632959 100 1 POINT (100.00504 0.99852)
New features and improvements
- #739, #800, #817, #825: New geoaccessor
dtoolkit.geoaccessor.geoseries.to_h3
to convert geometry to h3 index. - #778: Speed up
dtoolkit.accessor.series.textdistance_matrix
. - #779, #811, #819: New geoaccessor
dtoolkit.geoaccessor.dataframe.H3
to handle h3's geohash. - #784: New accessor
dtoolkit.accessor.series.to_zh
. - #794, #797: New geoaccessor for GeoDataFrame
dtoolkit.geoaccessor.geodataframe.xy
. - #801: New accessor for Series
dtoolkit.accessor.series.invert_or_not
. - #803: New geoaccessor
dtoolkit.geoaccessor.geoseries.select_geom_type
. - #804: New geoaccessor
dtoolkit.geoaccessor.geoseries.radius
. - #809: New accessor for Index
dtoolkit.accessor.index.len
.
Small bug-fix
- #780: Fix
dtoolkit.geoaccessor.dataframe.to_geoframe
's geometry isGeoSeries
. - #816: Fix
dtoolkit.geoaccessor.dataframe.to_geoframe
result CRS is missing. - #822:
dtoolkit.geoaccessor.dataframe.to_geoframe
supports replacing old geometry. - #824: Fix inputting
GeoDataFrame
butdtoolkit.accessor.dataframe.repeat
returnDataFrame
.