The mental model¶
Every geometry carries a complete Space: its coordinate
reference system, optional coordinate epoch, and curve model (planar, chart,
or spherical). The curve model defines the path between stored vertices; the
measurement metric decides how that path is measured. Changing the metric never
changes the curve.
Declare, transform, refine¶
Three rules govern every pipeline:
- Declare with
with_space— attaches or replaces the completeSpacewithout moving numeric coordinates. - Transform with
to_space— converts the represented shape into another targetSpace(reprojecting through PROJ and/or converting curve models). - Refine spatial candidates — a
SpatialIndex.candidatesbbox lookup or a grid cover narrows the search; it is not an exact geometry answer. Keep the source geometry and refine candidates with an exact predicate (SpatialIndex.query,gm.covers,gm.intersects).
See CRS, units & measurement, Candidates vs query, and Exact membership with the source geometry.
Curve models, metrics, and candidates¶
gometry separates curve interpretation, measurement, and discrete grid keys instead of conflating them:
- Curve model (
Space.model) — chooses what each edge represents: 'planar'— straight segments (and ISO SQL/MM curves & surfaces) in literal X/Y coordinates; matches PostGISgeometry.'chart'— straight longitude/latitude segments in a geographic CRS with periodic longitude, antimeridian seam, and polar-ring handling. See Geographic topology & antimeridian.'spherical'— minor great-circle arcs evaluated on the sphere without a longitude seam (backed by S2); matches PostGISgeography.- Measurement metric — on a geographic CRS, the default measuring surface is
the CRS ellipsoid: length and distance are in meters, area in square meters.
An explicit
Sphereselects a sphere instead. Projected CRSs use native linear units (with optionalunit='meters'), unreferenced geometries use raw coordinate units, andmetric='cartesian'measures planar coordinates directly. See CRS, units & measurement. - Discrete grid keys — H3,
S2, geohash, and XYZ tiles assign typed
CellArraykeys for grouping, joins, and prefiltering. Cell covers return candidates that should be refined with exact predicates against the source geometry. See Grids & geocodes.
- source region
- measured / exact result
- geodesic endpoints
- source region
- query window
- measured / exact result
- grid candidates
- source region
One geographic region viewed through gometry’s spatial layers: ellipsoidal measurement, topology, and discrete grid keys.
For naming rules, Python protocols, equality, and error types, see API conventions.