stilt.Mesh#

class stilt.Mesh(*, ids: tuple[str, ...], geometries: tuple[Any, ...], crs: str = '+proj=longlat') → None[source]#

Polygon cells with ids, the most general geometry.

Parameters

idssequence of str

Unique label for each cell. These become the index.

geometriessequence of shapely Polygon or MultiPolygon

One polygon per id, in crs coordinates.

crsstr, default “+proj=longlat”

PROJ string or "EPSG:xxxx" code of the polygon coordinates.

Methods#

from_file(path[, ids])

Return a mesh read from a vector file such as a shapefile, with geopandas.

from_geodataframe(gdf[, ids])

Return a mesh of the polygons in a GeoDataFrame's geometry column.

from_grid(grid)

Return every cell of a grid as a polygon, in grid.index order.

from_h3(resolution, bounds)

Return the H3 hexagons of one resolution inside bounds.

from_windows(coords, size, *[, ids, crs])

Return rectangular windows centered on points, such as known point sources.

to_crs(crs)

Return the mesh reprojected to crs.

Attributes#

bounds

(xmin, ymin, xmax, ymax) extent of all cells.

hash

First 10 characters of a SHA-256 hash of the ids, polygons, and CRS.

index

The cell ids, as an index named "cell".

is_longlat

Whether the polygon coordinates are longitude/latitude degrees.

min_cell_width

Shortest side of any cell's bounding box, in crs units.

ids

geometries

crs