itacart.cell_to_latlng
- itacart.cell_to_latlng(cell)[source]
H3-style alias of
cell_to_centroid()returning(lat, lng).Takes one cell and returns one point, which is the H3 contract this alias exists to offer. A compositional index naming more than one cell is refused rather than answered, because there is no single point to give and the alias would have to break its own signature to say so. Use
cell_to_centroid(), which returns a list for a composed index.The question asked is
is_atomic, not the type of whatcell_to_centroid()happens to return. The two agree today, since that function switches on the same predicate, but keying on the container type would make this guard depend on a decision belonging to another module, and it would fail open rather than closed if that decision ever changed.The refusal replaces a silent wrong answer. The previous implementation cast the result to a pair and unpacked it: for an index naming exactly two cells that cast was a lie the interpreter could not catch, and the call returned a pair of coordinate pairs, swapped, with no error. For three or more it raised an unpacking error that named nothing useful. Measured on
SW(0476/0260(4(A2(4(A4(1(E5)),A3(2(E1))))))), which returned((-46.6319..., -23.5508...), (-46.6328..., -23.5508...)).- Raises:
InvalidIndexError – If
cellnames more than one cell.NonExistentCellError – If any cell of the index names no cell. The predicate is the arbiter and the contract ends there: a spelling it denies is refused rather than answered for the cell it would otherwise fold onto.
- Parameters:
cell (
str)- Return type: