API Quick Reference#
Tip
Function names changed significantly with h3-py
v4.0
to align with the C library: https://h3geo.org/docs/library/migration-3.x/functions
We list the functions that are shared between the
provided APIs.
The APIs differ only in their input/output types
(e.g., int
vs. str
or list
vs numpy.array
).
These functions correspond to those explained in the H3 C library documentation, and should be generally aligned with the other language bindings.
Identification#
Validates an H3 cell (hexagon or pentagon). |
|
|
Identify if an H3 cell is a pentagon. |
Determine if cell has orientation "Class II" or "Class III". |
|
|
Validates an H3 unidirectional edge. |
Validates an H3 vertex. |
Index representation#
|
Converts an H3 64-bit integer index to a hexadecimal string. |
|
Converts a hexadecimal string to an H3 64-bit integer index. |
Cell properties#
Return all cells at resolution 0. |
|
|
Return all pentagons at a given resolution. |
|
Return the total number of cells (hexagons and pentagons) for the given resolution. |
Return the resolution of an H3 cell. |
|
Return the base cell number ( |
Geographic coordinates#
Functions relating H3 objects to geographic (lat/lng) coordinates.
|
Return the cell containing the (lat, lng) point for a given resolution. |
Return the center point of an H3 cell as a lat/lng pair. |
|
|
Compute the spherical surface area of a specific H3 cell. |
|
Compute the spherical length of a specific H3 edge. |
Return tuple of lat/lng pairs describing the cell boundary. |
|
Returns points representing the edge (line of points describing the boundary between two cells). |
|
|
Compute the spherical distance between two (lat, lng) points. |
|
Return the average area of an H3 hexagon for the given resolution. |
|
Return the average hexagon edge length for the given resolution. |
Hierarchical relationships#
|
Get the parent of a cell. |
|
Children of a cell as an unordered collection. |
|
Get the center child of a cell at some finer resolution. |
|
Number of children at resolution |
|
Child position index of given cell, with respect to its parent at |
|
Get child H3 cell from a parent cell, child resolution, and child position index. |
|
Compact a collection of H3 cells by combining smaller cells into larger cells, if all child cells are present. |
|
Reverse the |
Cell grid relationships#
|
Return unordered collection of cells with grid distance |
|
Return unordered collection of cells with grid distance |
|
Compute the grid distance between two cells. |
|
Returns |
|
Returns the ordered collection of cells denoting a minimum-length non-unique path between cells. |
Edges#
|
Create an H3 Index denoting a unidirectional edge. |
Return (origin, destination) tuple from H3 directed edge |
|
Origin cell from an H3 directed edge. |
|
Destination cell from an H3 directed edge. |
|
|
Return all directed edges starting from |
Vertexes#
|
Return a (specified) vertex of an H3 cell. |
Return a list of vertexes of an H3 cell. |
|
Return latitude and longitude of a vertex. |
Polygon interface#
The LatLngPoly
and LatLngMultiPoly
objects and their related functions allow users to represent (multi)polygons of lat/lng points and convert back and forth between H3 cells.
The objects and functions also compatible with the popular __geo_interface__
protocol, which is used by Python geospatial libraries like GeoPandas and many plotting libraries.
See the polygon tutorial for a walkthrough.
Tip
As with other h3-py
functions, the polygon interface expects coordinate pairs in lat/lng order.
Note that this is reversed from __geo_interface__
objects, which are given in lng/lat order.
Polygon objects#
|
Abstract parent class of |
|
Container for loops of lat/lng points describing a polygon, possibly with holes. |
|
Container for multiple |
Conversion functions#
|
Translate from an |
|
Translate from |
|
Return the collection of H3 cells at a given resolution whose center points are contained within an |
|
Return an |
|
Convert from |
|
Convert from cells to a |
Specialized functions#
h3-py
library#
|
Version numbers for the Python (wrapper) and C (wrapped) libraries. |
IJ-indexing#
Return icosahedron faces intersecting a given H3 cell. |
|
|
Return local (i,j) coordinates of cell |
|
Return cell at local (i,j) position relative to the |