itacart.topology
Neighbourhood and adjacency on the parallelogram lattice.
Completes OGC DGGS Core requirement 17. Adjacency is derived from the index
strings alone; coordinates are never consulted to find a neighbour, only
itacart.boundary.is_valid_cell() is asked whether the neighbour exists,
and that predicate is closed form in the cosine of the latitude.
The cell is a parallelogram sheared by 45 degrees, with its base equal to its
height, so a step toward the pole also moves one column toward the prime
meridian. On the parallels plane the step measures dx = -10 km and
dy = +10 km exactly. In index space the four edge-adjacent steps are the
same arithmetic in all four quadrants, because quadrant mirroring keeps X
growing away from the prime meridian and Y growing toward the pole:
N (X - 1, Y + 1) E (X + 1, Y)
S (X + 1, Y - 1) W (X - 1, Y)
Section 3.1 of the paper attaches the plus and minus one to Y for the
vertical step. The magnitude and the sign are right; the component is not.
Reading it literally returns the cell diagonally above, which shares a single
vertex rather than an edge, and every symmetry test still passes because a
diagonal is symmetric too.
The four vertex-adjacent steps are the sums of the edge steps, so NE is
(X, Y + 1), NW is (X - 2, Y + 1), SE is (X + 2, Y - 1) and
SW is (X, Y - 1).
Grid distance is measured on the lattice, not on the ellipsoid. Callers coming
from H3 tend to assume otherwise; use itacart.geodesy.inverse_geodesic()
on the anchors or centroids for metric separation.
Module constants
Lattice displacement of each direction, as |
|
In-parent displacement of each direction, as |
|
Separator between the two endpoints of a directed edge identifier. |
Functions
Whether two cells share an edge. |
|
Every directed edge leaving a cell. |
|
Identifier of the directed edge between two adjacent cells. |
|
Resolve a step whose lexical target falls outside its quadrant's range. |
|
Recover the origin and destination of a directed edge. |
|
Single adjacent cell in a given direction. |
|
Cells within |
|
Steps between two cells on the lattice. |
|
Cells at exactly |