itacart.geometry

Vector geometry against the grid: filling, vertex mapping, canonical form.

Two ways to represent a vector feature, both described in section 4 of the paper:

Cell filling - the feature is the set of cells it covers. Area follows from a cell count with no projection distortion, but the index grows verbose at fine resolutions.

Vertex representation - only the cells holding the polygon vertices are kept, as in conventional vector data. Far more compact, and the form the binary encodings in itacart.serialization are built on.

The descent

Filling never tests cells one by one. It projects the geometry onto the parallels plane, shears the 45-degree tiling onto a square lattice exactly as itacart.cells does, and walks the hierarchy: a node disjoint from the geometry is dropped whole, a node wholly inside is accepted whole, and only a node straddling the outline is subdivided. Cost therefore tracks the outline, not the area.

The shear is the same one the quantizer uses, u = |x| + |y| and v = |y|, applied per quadrant as a signed affine map so that the mirrored quadrants keep their own handedness. Its Jacobian is 1, so a cell count on the lattice is a cell count on the ellipsoid.

Scope

Filling runs on the parallelogram interior and on every family that is not the sheared square the ordinary descent tests. The prime-meridian column holds triangles and has a descent of its own, see _fill_meridian_node(); the last lattice column of a row, which absorbs the border strip, the polar row and the two caps are walked by _fill_border_root(). No family is refused.

Provenance: itacart_core/cell_filling.py, densification.py, geometry_blob.py (canonicalize_rings) and cadastral_processor/vertex_extractor.py. Two of the seven functions have no counterpart there: cells_to_geometry is absent from all four files, and the origin’s filling implements one containment mode of the three.

Module constants

MAX_FILL_CELLS

Ceiling on cells emitted by one polyfill() call.

EDGE_MODELS

Edge interpretations densify_segment() understands.

Functions

canonicalize_rings

Normalise rings to a single spelling per geometry.

cells_to_geometry

Rebuild a geometry from an ordered vertex cell list.

count_internal_cells

Count the cells a polygon covers, without naming any of them.

densify_orthodromic

Insert intermediate vertices along geodesics.

densify_segment

Densify a single segment.

polyfill

Rasterise a geometry into a compositional index.

vertex_to_cell

Map geometry vertices to cells, preserving sequence.