stilt.config.Grid.from_geometry#
- classmethod Grid.from_geometry(geometry, *, cells_per_target=4.0, projection=None, max_cells=50000000)[source]#
Return a grid fine enough to resolve the cells of a geometry.
The bounds are the geometry’s extent, rounded outward to whole cells. The cell size is the smallest geometry cell width divided by
cells_per_target, rounded down to one significant figure.- Parameters:
geometry (Mesh, Zones, or Grid) – Geometry to resolve. Any object with
bounds,min_cell_width,crsorprojection, andis_longlat.cells_per_target (
float) – Grid cells across the smallest geometry cell.projection (
str|None) – Projection of the grid. Defaults to the geometry’s CRS; the geometry is reprojected when they differ.max_cells (
int) – Warn when the grid would have more cells than this.
- Returns:
The derived grid, with longitude/latitude bounds.
- Return type:
Grid