Closed yanaaero closed 1 year ago
The exactEdgeLength
function doesn't take an H3 cell as input - it takes an H3 edge. The 6 edges of an H3 cell may have slightly different lengths, depending on projection distortion, so you need to either get a specific edge to measure (e.g. by picking a neighbor and using cellsToDirectedEdge
) or use originToDirectedEdges
and average the length of each (or pick one at random, if close is good enough).
Thank you for the quick answer, Nick.
I have tried using h3.origin_to_directed_edges(h) - > module 'h3' has no attribute 'origin_to_directed_edges'
and also module 'h3' has no attribute 'cells_to_directed_edge' when trying to use it with two neighbour h3 indices. I have tried to search for some equivalent functions with different names inside the attributes' list, but no success.
Version 3.7.6
Could you please help me to understand what's wrong?
@yanaaero so between v3 and v4 the methods were renamed to be more consistent with each other.
The old name in v3 for Python is h3.get_h3_unidirectional_edges_from_hexagon
(This was a bad name for a variety of reasons, most importantly that it works for the 12 pentagons for each resolution, but also the redundant h3
in the name and "unidirectional" being more verbose and less common than "directed" when talking about graph structures.)
Thanks a lot!
I try to get the edge length of a certain hex, but get an error:
Code: import h3 my_h = '8a29a1d62527fff' print (h3.exact_edge_length(my_h, unit='m'))
Error: File "edges.pyx", line 84, in h3._cy.edges.edge_length File "edges.pyx", line 85, in h3._cy.edges.edge_length File "util.pyx", line 85, in h3._cy.util.check_edge H3EdgeError: Integer is not a valid H3 edge: 0x8a29a1d62527fff
similar function h3.cell_area(my_h, unit='m^2') works properly instead.