A package to return clipped H3 hexagons from the extent of an OSMnx network. Useful for anyone looking to use the H3 spatial indexing system in route analyses or spatial analyses, and for saving time sourcing H3 hexagons.
(L-R): London, Beijing, Washington DC
Example workflows are available here
Install the latest version from PyPI:
pip install networkh3
from networkh3 import NETWORKH3
NETWORKH3 requires three parameters: the area of interest, the type of OSMNx network, and the resolution of the returned H3 hexagons:
from networkh3 import NETWORKH3
NETWORKH3.get_h3('Leeds, United Kingdom', 'drive', 9)
Optional style keywords can also be specified:
from networkh3 import NETWORKH3
import contextily as cx
NETWORKH3.get_h3('Leeds, United Kingdom', 'drive', 9,
network_kwargs={
'node_size': 1,
'node_color': 'black',
'edge_color': 'red',
'edge_linewidth': 0.2},
h3_kwargs={
'facecolor': 'white',
'alpha': 0.6},
basemap_kwargs={
'source': cx.providers.Stamen.TonerLite}
)
The network and clipped H3 hexagons can then be used in analysis:
# Calling the network
NETWORKH3.network
# Calling the clipped H3 hexagons
NETWORKH3.h3
Contribute or log issues here
- Website: callumscoby.com
- Twitter: @ScobyCallum
- LinkedIn: @callumscoby