Order of returned children #589
-
Hi everybody, I was looking into the order I get back from the h3_to_children function. I only needed the center one and used the h3_to_center_child, but I was wondering if there is general order in which the children are returned. Like for example the first returned is always the top one, the second the one clockwise next to it (and if you go just one resolution down, the seventh always being the center) ? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There is a deterministic order to the returned cells in
So there's a lot of complexity around the indexing numbers that makes them too awkward for spatial reasoning. But the |
Beta Was this translation helpful? Give feedback.
There is a deterministic order to the returned cells in
h3_to_children
, and you can rely on it to be stable, but it's not the order you describe. The children are returned in "digit" order, which is to say child0
, child1
, child2
, and so on - these are the digits set in the hierarchical index (see the indexing docs for more info). Child0
is the center child, but beyond that you can't make assumptions about either the cardinal direction or even the grid direction of a numbered child.