Skip to content

Tessellation

Tilers that cover an area with square, hexagonal (H3) or Voronoi cells and return a GeoPandas table with a tile_id column, ready for TrajDataFrame.mapping and to_flowdataframe. They need the optional geopandas and shapely packages. Tilers are created through the tilers.tiler registry, for example tilers.tiler.create("squared", base_shape=area, meters=500); see Fill gaps, smooth, compare and convert trajectories for a worked example.

Catalogue

API Description Example
TessellationTilers Registry for tessellation tiler implementations. Build a grid and snap positions to it
TessellationTilers.create Build a tessellation with the tiler registered under key (squared, h3_tessellation, voronoi or your own). Build a grid and snap positions to it
TessellationTilers.get Alias of create: build a tessellation with the tiler registered as service_id. Build a grid and snap positions to it
TessellationTilers.register_tiler Register tiler_instance (a callable tiler object) under the name key, replacing any tiler of that name. Build a grid and snap positions to it
SquaredTessellationTiler Build a square grid over a base shape.
H3TessellationTiler Build an H3 hexagonal tessellation over a base shape.
VoronoiTessellationTiler Build a point tessellation from input points.

TessellationTilers

Registry for tessellation tiler implementations.

create(key, **kwargs)

Build a tessellation with the tiler registered under key (squared, h3_tessellation, voronoi or your own).

Keyword arguments are passed to the tiler: base_shape and meters for the squared and H3 tilers, points for the Voronoi tiler. Returns a GeoDataFrame with tile_id and geometry. Raises ValueError for an unknown key.

get(service_id, **kwargs)

Alias of create: build a tessellation with the tiler registered as service_id.

register_tiler(key, tiler_instance)

Register tiler_instance (a callable tiler object) under the name key, replacing any tiler of that name.

Worked example: Build a grid and snap positions to it


SquaredTessellationTiler

Bases: TessellationTiler

Build a square grid over a base shape.


H3TessellationTiler

Bases: TessellationTiler

Build an H3 hexagonal tessellation over a base shape.


VoronoiTessellationTiler

Bases: TessellationTiler

Build a point tessellation from input points.