-
Notifications
You must be signed in to change notification settings - Fork 132
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
upgrade to h3 v4.2.0 #432
Merged
+240
−10
Merged
upgrade to h3 v4.2.0 #432
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -467,7 +467,7 @@ | |
return _out_collection(hu) | ||
|
||
|
||
def h3shape_to_cells(h3shape, res): | ||
def h3shape_to_cells(h3shape, res, flags=0, experimental=False): | ||
""" | ||
Return the collection of H3 cells at a given resolution whose center points | ||
are contained within an ``LatLngPoly`` or ``LatLngMultiPoly``. | ||
|
@@ -477,6 +477,10 @@ | |
h3shape : ``H3Shape`` | ||
res : int | ||
Resolution of the output cells | ||
flags : int | ||
Containment mode flags | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
experimental : bool | ||
Whether to use experimental algorithm. | ||
|
||
Returns | ||
------- | ||
|
@@ -506,10 +510,16 @@ | |
# todo: not sure if i want this dispatch logic here. maybe in the objects? | ||
if isinstance(h3shape, LatLngPoly): | ||
poly = h3shape | ||
mv = _cy.polygon_to_cells(poly.outer, res, holes=poly.holes) | ||
if experimental: | ||
mv = _cy.polygon_to_cells_experimental(poly.outer, res=res, holes=poly.holes, flags=flags) | ||
else: | ||
mv = _cy.polygon_to_cells(poly.outer, res=res, holes=poly.holes) | ||
elif isinstance(h3shape, LatLngMultiPoly): | ||
mpoly = h3shape | ||
mv = _cy.polygons_to_cells(mpoly.polys, res) | ||
if experimental: | ||
mv = _cy.polygons_to_cells_experimental(mpoly.polys, res=res, flags=flags) | ||
else: | ||
mv = _cy.polygons_to_cells(mpoly.polys, res=res) | ||
elif isinstance(h3shape, H3Shape): | ||
raise ValueError('Unrecognized H3Shape: ' + str(h3shape)) | ||
else: | ||
|
@@ -518,11 +528,11 @@ | |
return _out_collection(mv) | ||
|
||
|
||
def polygon_to_cells(h3shape, res): | ||
def polygon_to_cells(h3shape, res, flags=0, experimental=False): | ||
""" | ||
Alias for ``h3shape_to_cells``. | ||
""" | ||
return h3shape_to_cells(h3shape, res) | ||
return h3shape_to_cells(h3shape, res, flags=flags, experimental=experimental) | ||
|
||
|
||
def cells_to_h3shape(cells, *, tight=True): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this should be the final form of the API. For example, we might not use integers for the flags, and we may drop the
experimental
option.But it would be nice to get this functionality out so folks can start playing with it.
For the time being, could we leave
h3shape_to_cells
unchanged, and just create ah3shape_to_cells_experimental
where we're free to change the API in the future?