Skip to content

Commit

Permalink
chore: bump h3ronpy version to 0.18.0 (#361)
Browse files Browse the repository at this point in the history
* chore: bump h3ronpy version to 0.18.0

* chore: change h3ronpy api in regionalization

* chore: added changelog entry
  • Loading branch information
RaczeQ authored Sep 27, 2023
1 parent deb0173 commit 8c58fc3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Bumped `h3ronpy` library to `0.17.5` with added support for MacOS. Removed override with check for H3 operations if system is `darwin`.
- Bumped `h3ronpy` library to `0.18.0` with added support for MacOS. Removed override with check for H3 operations if system is `darwin`. Changed internal API to use `ContainmentMode`.
- Refactored `OSMLoader`'s `GroupedOsmTagsFilter` features grouping to be faster by refactoring pandas operations [#354](https://github.com/srai-lab/srai/issues/354)

### Deprecated
Expand Down
16 changes: 8 additions & 8 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
"s2",
"typeguard",
"requests",
"h3ronpy>=0.17.5",
"h3ronpy>=0.18.0",
]
requires-python = ">=3.8"
readme = "README.md"
Expand Down
7 changes: 5 additions & 2 deletions srai/h3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import h3
import numpy as np
import numpy.typing as npt
from h3ronpy.arrow.vector import cells_to_wkb_polygons, wkb_to_cells
from h3ronpy.arrow.vector import ContainmentMode, cells_to_wkb_polygons, wkb_to_cells
from shapely.geometry import Polygon
from shapely.geometry.base import BaseGeometry

Expand Down Expand Up @@ -57,8 +57,11 @@ def shapely_geometry_to_h3(
else:
wkb = [geometry.wkb]

containment_mode = (
ContainmentMode.IntersectsBoundary if buffer else ContainmentMode.ContainsCentroid
)
h3_indexes = wkb_to_cells(
wkb, resolution=h3_resolution, all_intersecting=buffer, flatten=True
wkb, resolution=h3_resolution, containment_mode=containment_mode, flatten=True
).unique()

return [h3.int_to_str(h3_index) for h3_index in h3_indexes.tolist()]
Expand Down

0 comments on commit 8c58fc3

Please sign in to comment.