itacart.cells.cell_to_anchor
- itacart.cells.cell_to_anchor(cell)[source]
Anchor of a cell: the vertex its index literally encodes.
The anchor is not the representative position. The paper offers the lower-left vertex for that role, so that addressing behaves like a Cartesian system for surveyors, and names it for OGC Core requirement 12. The requirement asks for a position within the cell, and a vertex lies on its boundary, so this package designates the centroid instead:
cell_to_centroid()is the one point every single-point route answers with, and it is whatitacart.engine.describe()declares. The anchor remains what it is – the lattice corner the descent inverts exactly – and the metrics that are defined at a corner are measured here.“Lower-left” is meant in the cell’s own quadrant: the vertex nearest the equator and nearest the prime meridian. It is the vertex the index literally encodes, so
cell_to_anchorinverts the descent exactly, with no averaging.Triangular cells differ. A prime-meridian cell reports the midpoint of its base, which the paper names directly: the cell index “intersects with the prime meridian and functions as the midpoint of the base of an isosceles triangle”. That point is not a vertex of the cell, and for a triangle refined into inverted children the base is the side away from the equator rather than toward it.
Use
cell_to_centroid()when a centre point is wanted.Restriction. The anchor identifies its cell uniquely except where
is_quadrant_boundary_cell()is true, which is the southern row0000and nowhere else. See that function for why the exception cannot be removed.- Parameters:
cell (
str) – Compositional index string.- Return type:
- Returns:
(lon, lat)for a single cell, or a positionally aligned list.- Raises:
ResolutionError – If the index addresses a whole quadrant, which has no anchor.
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.