Index inspection functions
These functions provide metadata about an H3 index, such as its resolution or base cell, and provide utilities for converting into and out of the 64-bit representation of an H3 index.
h3GetResolution
- C
- Python
- Java
- JavaScript (Live)
int h3GetResolution(H3Index h);
h3.h3_get_resolution(h)
int h3GetResolution(long h3);
int h3GetResolution(String h3Address);
h3.h3GetResolution(h)
Returns the resolution of the index.
h3GetBaseCell
- C
- Python
- Java
- JavaScript (Live)
int h3GetBaseCell(H3Index h);
h3.h3_get_base_cell(h)
int h3GetBaseCell(long h3);
int h3GetBaseCell(String h3Address);
h3.h3GetBaseCell(h)
Returns the base cell number of the index.
stringToH3
- C
- Python
- Java
- JavaScript (Live)
H3Index stringToH3(const char *str);
h3.string_to_h3(h)
long stringToH3(String h3Address);
The H3 JavaScript binding supports only the string representation of an H3 index.
Converts the string representation to H3Index
(uint64_t
) representation.
Returns 0 on error.
h3ToString
- C
- Python
- Java
- JavaScript (Live)
void h3ToString(H3Index h, char *str, size_t sz);
h3.h3_to_string(h)
String h3ToString(long h3);
The H3 JavaScript binding supports only the string representation of an H3 index.
Converts the H3Index
representation of the index to the string representation. str
must be at least of length 17.
h3IsValid
- C
- Python
- Java
- JavaScript (Live)
int h3IsValid(H3Index h);
h3.h3_is_valid(h)
boolean h3IsValid(long h3);
boolean h3IsValid(String h3Address);
h3.h3IsValid(h)
Returns non-zero if this is a valid H3 index.
h3IsResClassIII
- C
- Python
- Java
- JavaScript (Live)
int h3IsResClassIII(H3Index h);
h3.h3_is_res_class_III(h)
boolean h3IsResClassIII(long h3);
boolean h3IsResClassIII(String h3Address);
h3.h3IsResClassIII(h)
Returns non-zero if this index has a resolution with Class III orientation.
h3IsPentagon
- C
- Python
- Java
- JavaScript (Live)
int h3IsPentagon(H3Index h);
h3.h3_is_pentagon(h)
boolean h3IsPentagon(long h3);
boolean h3IsPentagon(String h3Address);
h3.h3IsPentagon(h)
Returns non-zero if this index represents a pentagonal cell.
h3GetFaces
- C
- Python
- Java
- JavaScript (Live)
void h3GetFaces(H3Index h, int* out);
h3.h3_get_faces(h)
Collection<Integer> h3GetFaces(long h3);
Collection<Integer> h3GetFaces(String h3Address);
h3.h3GetFaces(h)
Find all icosahedron faces intersected by a given H3 index and places them in the array out
. out
must be at least of length maxFaceCount(h)
.
Faces are represented as integers from 0-19, inclusive. The array is sparse, and empty (no intersection) array values are represented by -1.
maxFaceCount
- C
- Python
- Java
- JavaScript (Live)
int maxFaceCount(H3Index h3);
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.
Returns the maximum number of icosahedron faces the given H3 index may intersect.