Skip to main content

geometry_covering

Function geometry_covering 

Source
pub fn geometry_covering(geometry: &Geometry<f64>) -> CellUnion
Expand description

Covering of a CRS84 polygon (or any area geometry) under the live config.

The coverer spends the max_cells budget on fewer, coarser cells that stick OUTSIDE the surface when the shape is awkward — a valid superset, which is exactly what a candidate probe needs.

Densification contract: S2 region edges are geodesic arcs, while WKT edges are straight lines in lon/lat space; on continental-scale edges the two interpretations of the same coordinates diverge by up to ~1° — far more than the covering’s cell overshoot — so an undensified covering is NOT a superset of the planar (WKT/JTS/GeoSPARQL) region and the candidate index silently drops planar-inside geometries near such edges. Before the coverer runs, every polygon/line-string edge longer than CovererConfig::densify_step_deg is subdivided so the geodesic chain hugs the planar edge within that step’s chord-deviation bound; ingest and query constants densify identically here, which is what makes the candidate set a superset of the exact planar answer. 0.0 disables (raw rings).

Edges whose endpoints straddle the antimeridian (e.g. 179.9 → -179.9 longitude) densify the long planar way — straight through lon 0, the same 359.8° reading WKT/JTS give such an edge — so the contract holds against planar engines, but data with genuine antimeridian-crossing edges pays the full traverse in vertices and covering cost. If that cost bites, disable the step (0.0) or pre-split such rings at ±180.