A small utility package which calculates a regular hexagonal tiling for an area, given a centroid as a Shapely Point, and a side length.
Hexcover
is available on PyPI:
pip install hexcover
from shapely.geometry import Point
from hexcover.util import hexagon_coverage
# centroid
c = Point(0.0, 0.0)
coverage = hexagon_coverage(c, 10)
# coverage is a namedtuple of seven polygons. The first entry is the central polygon.
# Subsequent entries begin directly above the central polygon, and proceed clockwise.
The returned namedtuple
has seven fields:
centre
top
topright
bottomright
bottom
bottomleft
topleft
There's an example notebook, and a sample output GeoJSON file showing the result of covering the Crystal Palace Transmitting Station with 100-metre hexagons.
Shapely
>= 1.6.3