voxcity.utils.zoningยถ
Lon/lat polygon utilities for VoxCity grids.
Bridges geographic polygons (closed lon/lat rings, GeoJSON-style) into the gridโs (i, j) cell frame. Algorithm: project every cell centre to lon/lat via GridProjector, then test point-in-polygon with MplPath.
Functionsยถ
|
Rasterize a closed lon/lat ring to a (nx, ny) boolean mask. |
|
Rasterize a lon/lat ring to a list of (i, j) cell indices. |
|
Vectorized point-in-polygon test (boolean array of length N). |
Module Contentsยถ
- voxcity.utils.zoning.mask_from_lonlat_ring(ring: Sequence[Sequence[float]], grid_geom: voxcity.utils.projector.GridGeom) numpy.ndarray[source]ยถ
Rasterize a closed lon/lat ring to a (nx, ny) boolean mask.
A cell is True iff its centre lies inside the polygon.
- voxcity.utils.zoning.polygon_lonlat_to_cells(ring: Sequence[Sequence[float]], grid_geom: voxcity.utils.projector.GridGeom) List[Tuple[int, int]][source]ยถ
Rasterize a lon/lat ring to a list of (i, j) cell indices.
Equivalent to
np.argwhere(mask_from_lonlat_ring(...))returned as a list of Python tuples. Provided for parity with the helper that has historically lived in app/backend/zoning.py; new code should prefermask_from_lonlat_ring.