itacart.cells.geo_to_cell

itacart.cells.geo_to_cell(lon, lat, resolution)[source]

Address the cell containing a geodetic position.

Projects onto the ellipsoidal parallels plane, mirrors into the quadrant’s positive octant, shears onto the square lattice, then descends: the resolution-1 Cartesian pair, then alternating 1-to-4 and 1-to-25 refinements. The descent stays in plane metres throughout; no trigonometry runs below resolution 1.

Parameters:
  • lon (float) – Longitude in decimal degrees, in [-180, 180]. Inside the latitude band of an extension zone the eastern spelling past 180 degrees is accepted as well, out to the meridian the extension reaches, because that is how the package writes positions there.

  • lat (float) – Latitude in decimal degrees.

  • resolution (int) – Target resolution level, 1 to 13.

Return type:

str

Returns:

The atomic compositional index of the containing cell. Over every lattice the test suite enumerates, both caps at every resolution included, itacart.boundary.is_valid_cell() confirms it. Not inside the cell that holds a pole at resolution 10: there, at resolutions 11 and 12, the answer can be a spelling that names no cell, which the predicate denies (a known limitation; see the module’s notes).

Raises: