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#

Parameter

Description

Default

ids

Unique label for each cell. These become the index.

Required

geometries

One shapely Polygon or MultiPolygon per id, in crs coordinates.

Required

crs

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

'+proj=longlat'

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.

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_spec(spec)

Return the mesh a footprint config's geometry describes, reading its source now.

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.

to_grid(*[, cells_per_target, crs, max_cells])

Return a footprint grid fine enough to resolve the cells.