stilt.Mesh.to_grid#

Mesh.to_grid(*, cells_per_target=4.0, crs=None, max_cells=50000000)[source]#

Return a footprint grid fine enough to resolve the cells.

The bounds are the mesh’s extent, rounded outward to whole cells. The cell size is the smallest cell width divided by cells_per_target, rounded down to one significant figure.

Parameters:
  • cells_per_target (float) – Grid cells across the smallest mesh cell.

  • crs (str | None) – CRS of the grid. Defaults to the mesh’s; the mesh is reprojected when they differ.

  • max_cells (int) – Warn when the grid would have more cells than this.

Returns:

The grid, with longitude/latitude bounds.

Return type:

Grid

Examples

>>> hexes = stilt.Mesh.from_h3(7, bounds)
>>> grid = hexes.to_grid(cells_per_target=4)