stilt.config.Grid.from_geometry#

classmethod Grid.from_geometry(geometry, *, cells_per_target=4.0, projection=None, max_cells=50000000)[source]#

Derive the native raster that resolves a non-rectilinear geometry.

Bounds are the geometry’s envelope snapped outward to whole cells. Resolution is the smallest target cell width divided by cells_per_target, rounded down to one significant figure so file names and hashes stay readable. projection defaults to the geometry’s CRS. Warns when the raster would exceed max_cells.

Parameters:
  • geometry (Mesh | Zones | Grid) – Target geometry (any object with bounds, min_cell_width, crs/projection and is_longlat).

  • cells_per_target (float, default 4) – Native cells across the smallest target cell.

  • projection (str, optional) – Output CRS; the geometry is reprojected when it differs. Bounds are always stored in lon/lat.

  • max_cells (int)

Return type:

Grid