Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

polygon_to_cells alias #399

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/h3/api/basic_int/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,13 @@ def h3shape_to_cells(h3shape, res):
return _out_collection(mv)


def polygon_to_cells(h3shape, res):
"""
Alias for ``h3shape_to_cells``.
"""
return h3shape_to_cells(h3shape, res)


def cells_to_h3shape(cells, *, tight=True):
"""
Return an ``H3Shape`` describing the area covered by a collection of H3 cells.
Expand Down
10 changes: 10 additions & 0 deletions tests/polyfill/test_h3.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ def test_polyfill():
assert '89283095edbffff' in out


def test_polygon_to_cells():
poly = h3.LatLngPoly(sf_7x7)
# Note that `polygon_to_cells` is an alias for `h3shape_to_cells`
out = h3.polygon_to_cells(poly, res=9)

assert len(out) == 1253
assert '89283080527ffff' in out
assert '89283095edbffff' in out


def test_polyfill_with_hole():
poly = h3.LatLngPoly(sf_7x7, sf_hole1)

Expand Down
Loading