h3-py: Uber’s H3 Hexagonal Hierarchical Geospatial Indexing System in Python
Contents
h3-py: Uber’s H3 Hexagonal Hierarchical Geospatial Indexing System in Python#
Python bindings for theH3 core library.
Documentation:uber.github.io/h3-py
GitHub repo:github.com/uber/h3-py
Installation#
FromPyPI:
pip install h3Fromconda:
conda config --add channels conda-forgeconda install h3-py
Usage#
>>>importh3>>>lat,lng=37.769377,-122.388903>>>resolution=9>>>h3.latlng_to_cell(lat,lng,resolution)'89283082e73ffff'
APIs#
We providemultiple APIs inh3-py.
All APIs have the same set of functions;see theAPI reference.
The APIs differ only in their input/output formats;see theAPI comparison page.
Example gallery#
Browsea collection of example notebooks,and if you have examples or visualizations of your own, please feel freeto contribute!
We also have an introductorywalkthrough of the API.
Versioning#
h3-py wraps theH3 core library,which is written in C.The C and Python projects each employsemantic versioning,where versions take the formX.Y.Z.
Theh3-py version string is guaranteed to match the C library stringin bothmajor andminor numbers (X.Y), but may differ on thepatch (Z) number.This convention provides users with information on breaking changes andfeature additions, while providing downstream bindings (like this one!)with the versioning freedom to fix bugs.
Useh3.versions() to see the version numbers for bothh3-py and the C library. For example,
>>>importh3>>>h3.versions(){'c': '4.1.0', 'python': '4.1.1'}