voxcity.utils.zoning ==================== .. py:module:: voxcity.utils.zoning .. autoapi-nested-parse:: 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 --------- .. autoapisummary:: voxcity.utils.zoning.mask_from_lonlat_ring voxcity.utils.zoning.polygon_lonlat_to_cells voxcity.utils.zoning.points_in_polygon_lonlat Module Contents --------------- .. py:function:: mask_from_lonlat_ring(ring: Sequence[Sequence[float]], grid_geom: voxcity.utils.projector.GridGeom) -> numpy.ndarray Rasterize a closed lon/lat ring to a (nx, ny) boolean mask. A cell is True iff its centre lies inside the polygon. .. py:function:: polygon_lonlat_to_cells(ring: Sequence[Sequence[float]], grid_geom: voxcity.utils.projector.GridGeom) -> List[Tuple[int, int]] 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 prefer ``mask_from_lonlat_ring``. .. py:function:: points_in_polygon_lonlat(points_lonlat: numpy.ndarray, ring: Sequence[Sequence[float]]) -> numpy.ndarray Vectorized point-in-polygon test (boolean array of length N).