Miscellaneous H3 functions
These functions include descriptions of the H3 grid system.
degsToRads
- C
- Python
- Java
- JavaScript (Live)
double degsToRads(double degrees);
Use math.radians(degrees)
instead.
Use java.lang.Math.toRadians(double degrees)
instead.
h3.degsToRads(degrees)
Converts degrees to radians.
radsToDegs
- C
- Python
- Java
- JavaScript (Live)
double radsToDegs(double radians);
Use math.degrees(radians)
instead.
Use java.lang.Math.toDegrees(double radians)
instead.
h3.radsToDegs(h)
Converts radians to degrees.
getHexagonAreaAvgKm2
- C
- Python
- Java
- JavaScript (Live)
H3Error getHexagonAreaAvgKm2(int res, double *out);
h3.get_hexagon_area_avg(res, unit='km^2')
double getHexagonAreaAvg(int res, AreaUnit unit);
h3.getHexagonAreaAvg(res, h3.UNITS.km2)
Average hexagon area in square kilometers at the given resolution. Excludes pentagons.
getHexagonAreaAvgM2
- C
- Python
- Java
- JavaScript (Live)
H3Error getHexagonAreaAvgM2(int res, double *out);
h3.get_hexagon_area_avg(res, unit='m^2')
double getHexagonAreaAvg(int res, AreaUnit unit);
h3.getHexagonAreaAvg(res, h3.UNITS.m2)
Average hexagon area in square meters at the given resolution. Excludes pentagons.
cellAreaRads2
- C
- Python
- Java
- JavaScript (Live)
H3Error cellAreaRads2(H3Index h, double *out);
h3.cell_area(h, unit='rads^2')
double cellArea(long h3, AreaUnit unit);
int cellArea(String h3Address, AreaUnit unit);
h3.cellArea(h, h3.UNITS.rads2)
Exact area of specific cell in square radians.
cellAreaKm2
- C
- Python
- Java
- JavaScript (Live)
H3Error cellAreaKm2(H3Index h, double *out);
h3.cell_area(h, unit='km^2')
double cellArea(long h3, AreaUnit unit);
int cellArea(String h3Address, AreaUnit unit);
h3.cellArea(h, h3.UNITS.km2)
Exact area of specific cell in square kilometers.
cellAreaM2
- C
- Python
- Java
- JavaScript (Live)
H3Error cellAreaM2(H3Index h, double *out);
h3.cell_area(h, unit='m^2')
double cellArea(long h3, AreaUnit unit);
int cellArea(String h3Address, AreaUnit unit);
h3.cellArea(h, h3.UNITS.m2)
Exact area of specific cell in square meters.
getHexagonEdgeLengthAvgKm
- C
- Python
- Java
- JavaScript (Live)
H3Error getHexagonEdgeLengthAvgKm(int res, double *out);
h3.get_hexagon_edge_length_avg(res, unit='km')
double getHexagonEdgeLengthAvg(int res, LengthUnit unit);
h3.getHexagonEdgeLengthAvg(res, h3.UNITS.km)
Average hexagon edge length in kilometers at the given resolution. Excludes pentagons.
getHexagonEdgeLengthAvgM
- C
- Python
- Java
- JavaScript (Live)
H3Error getHexagonEdgeLengthAvgM(int res, double *out);
h3.get_hexagon_edge_length_avg(res, unit='m')
double getHexagonEdgeLengthAvg(int res, LengthUnit unit);
h3.getHexagonEdgeLengthAvg(res, h3.UNITS.m)
Average hexagon edge length in meters at the given resolution. Excludes pentagons.
edgeLengthKm
- C
- Python
- Java
- JavaScript (Live)
H3Error edgeLengthKm(H3Index edge, double *length);
h3.exact_edge_length(h, unit='km')
double edgeLength(long h3, LengthUnit unit);
double edgeLength(String h3Address, LengthUnit unit);
h3.edgeLength(h3, h3.UNITS.km)
Exact edge length of specific unidirectional edge in kilometers.
edgeLengthM
- C
- Python
- Java
- JavaScript (Live)
H3Error edgeLengthM(H3Index edge, double *length);
h3.exact_edge_length(h, unit='m')
double edgeLength(long h3, LengthUnit unit);
double edgeLength(String h3Address, LengthUnit unit);
h3.edgeLength(h3, h3.UNITS.m)
Exact edge length of specific unidirectional edge in meters.
edgeLengthRads
- C
- Python
- Java
- JavaScript (Live)
H3Error edgeLengthRads(H3Index edge, double *length);
h3.exact_edge_length(h, unit='rads')
double edgeLength(long h3, LengthUnit unit);
double edgeLength(String h3Address, LengthUnit unit);
h3.edgeLength(h3, h3.UNITS.rads)
Exact edge length of specific unidirectional edge in radians.
getNumCells
- C
- Python
- Java
- JavaScript (Live)
H3Error getNumCells(int res, int64_t *out);
h3.get_num_cells(res)
long getNumCells(int res);
h3.getNumCells(res)
Number of unique H3 indexes at the given resolution.
getRes0Cells
- C
- Python
- Java
- JavaScript (Live)
H3Error getRes0Cells(H3Index *out);
h3.get_res0_cells(res)
Collection<Long> getRes0Cells(int res);
Collection<String> getRes0CellAddresses(int res);
h3.getRes0Cells(res)
All the resolution 0 H3 indexes.
out
must be an array of at least size res0CellCount()
.
res0CellCount
- C
- Python
- Java
- JavaScript (Live)
int res0CellCount();
This function exists for memory management and is not exposed.
This function exists for memory management and is not exposed.
This function exists for memory management and is not exposed.
Number of resolution 0 H3 indexes, which is defined as 122.
getPentagons
- C
- Python
- Java
- JavaScript (Live)
H3Error getPentagons(int res, H3Index *out);
h3.get_pentagons(res)
Collection<Long> h3.getPentagons(int res);
Collection<String> h3.getPentagonsAddresses(int res);
h3.getPentagons(res)
All the pentagon H3 indexes at the specified resolution.
out
must be an array of at least size pentagonIndexCount()
.
Returns 0 (E_SUCCESS
) on success.
pentagonCount
- C
- Python
- Java
- JavaScript (Live)
int pentagonCount();
This function exists for memory management and is not exposed.
This function exists for memory management and is not exposed.
This function exists for memory management and is not exposed.
Number of pentagon H3 indexes per resolution. This is always 12, but provided as a convenience.
greatCircleDistanceKm
- C
- Python
- Java
- JavaScript (Live)
double greatCircleDistanceKm(const LatLng *a, const LatLng *b);
h3.great_circle_distance(point1, point2, unit='km')
double greatCircleDistance(LatLng point1, LatLng point2, LengthUnit unit);
h3.greatCircleDistance(point1, point2, h3.UNITS.km)
Gives the "great circle" or "haversine" distance between pairs of LatLng points (lat/lng pairs) in kilometers.
greatCircleDistanceM
- C
- Python
- Java
- JavaScript (Live)
double greatCircleDistanceM(const LatLng *a, const LatLng *b);
h3.latlng_distance(point1, point2, unit='m')
double greatCircleDistance(LatLng point1, LatLng point2, LengthUnit unit);
h3.greatCircleDistance(point1, point2, h3.UNITS.m);
Gives the "great circle" or "haversine" distance between pairs of LatLng points (lat/lng pairs) in meters.
greatCircleDistanceRads
- C
- Python
- Java
- JavaScript (Live)
double greatCircleDistanceRads(const LatLng *a, const LatLng *b);
h3.latlng_distance(point1, point2, unit='rads')
double greatCircleDistance(LatLng point1, LatLng point2, LengthUnit unit);
h3.greatCircleDistance(point1, point2, h3.UNITS.rads)
Gives the "great circle" or "haversine" distance between pairs of LatLng points (lat/lng pairs) in radians.