tobler.util.h3fy¶
- tobler.util.h3fy(source, resolution=6, clip=False, buffer=False, return_geoms=True)[source]¶
Generate a hexgrid geodataframe that covers the face of a source geodataframe.
- Parameters:
- source
geopandas.GeoDataFrame
GeoDataFrame to transform into a hexagonal grid
- resolution
int
, optional (defaultis
6) resolution of output h3 hexgrid. See <https://h3geo.org/docs/core-library/restable> for more information
- clipbool, optional (default
is
False
) if True, hexagons are clipped by the boundary of the source gdf. Otherwise, heaxgons along the boundary will be left intact.
- bufferbool, optional (default
is
False
) if True, force hexagons to completely fill the interior of the source area. if False, (h3 default) may result in empty areas within the source area.
- return_geoms: bool, optional (default is True)
whether to generate hexagon geometries as a geodataframe or simply return hex ids as a pandas.Series
- source
- Returns:
pandas.Series
orgeopandas.GeoDataFrame
if return_geoms is True, a geopandas.GeoDataFrame whose rows comprise a hexagonal h3 grid (indexed on h3 hex id). if return_geoms is False, a pandas.Series of h3 hexagon ids