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.
getResolution
- C
- Python
- Java
- JavaScript (Live)
int getResolution(H3Index h);
h3.get_resolution(h)
int getResolution(long h3);
int getResolution(String h3Address);
h3.getResolution(h)
Returns the resolution of the index.
getBaseCellNumber
- C
- Python
- Java
- JavaScript (Live)
int getBaseCellNumber(H3Index h);
h3.get_base_cell_number(h)
int getBaseCellNumber(long h3);
int getBaseCellNumber(String h3Address);
h3.getBaseCellNumber(h)
Returns the base cell number of the index.
stringToH3
- C
- Python
- Java
- JavaScript (Live)
H3Error stringToH3(const char *str, H3Index *out);
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 (E_SUCCESS
) on success.
h3ToString
- C
- Python
- Java
- JavaScript (Live)
H3Error 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.
Returns 0 (E_SUCCESS
) on success.
isValidCell
- C
- Python
- Java
- JavaScript (Live)
int isValidCell(H3Index h);
h3.is_valid_cell(h)
boolean isValidCell(long h3);
boolean isValidCell(String h3Address);
h3.isValidCell(h)
Returns non-zero if this is a valid H3 cell index.
isResClassIII
- C
- Python
- Java
- JavaScript (Live)
int isResClassIII(H3Index h);
h3.is_res_class_III(h)
boolean isResClassIII(long h3);
boolean isResClassIII(String h3Address);
h3.isResClassIII(h)
Returns non-zero if this index has a resolution with Class III orientation.
isPentagon
- C
- Python
- Java
- JavaScript (Live)
int isPentagon(H3Index h);
h3.is_pentagon(h)
boolean isPentagon(long h3);
boolean isPentagon(String h3Address);
h3.isPentagon(h)
Returns non-zero if this index represents a pentagonal cell.
getIcosahedronFaces
- C
- Python
- Java
- JavaScript (Live)
H3Error getIcosahedronFaces(H3Index h, int* out);
h3.get_icosahedron_faces(h)
Collection<Integer> getIcosahedronFaces(long h3);
Collection<Integer> getIcosahedronFaces(String h3Address);
h3.getIcosahedronFaces(h)
Find all icosahedron faces intersected by a given H3 index and places them in the array out
. out
must be at least length of 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.
Returns 0 (E_SUCCESS
) on success.
maxFaceCount
- C
- Python
- Java
- JavaScript (Live)
H3Error maxFaceCount(H3Index h3, int *out);
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.