website/versioned_docs/version-3.x/api/inspection.mdx
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
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.
<Tabs groupId="language" defaultValue="c" values={[ {label: 'C', value: 'c'}, {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, ] }> <TabItem value="c">
int h3GetResolution(H3Index h);
h3.h3_get_resolution(h)
int h3GetResolution(long h3);
int h3GetResolution(String h3Address);
h3.h3GetResolution(h)
function example() {
const h = '85283473fffffff';
return h3v3.h3GetResolution(h);
}
Returns the resolution of the index.
<Tabs groupId="language" defaultValue="c" values={[ {label: 'C', value: 'c'}, {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, ] }> <TabItem value="c">
int h3GetBaseCell(H3Index h);
h3.h3_get_base_cell(h)
int h3GetBaseCell(long h3);
int h3GetBaseCell(String h3Address);
h3.h3GetBaseCell(h)
function example() {
const h = '85283473fffffff';
return h3v3.h3GetBaseCell(h);
}
Returns the base cell number of the index.
<Tabs groupId="language" defaultValue="c" values={[ {label: 'C', value: 'c'}, {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, ] }> <TabItem value="c">
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.
</TabItem> </Tabs>Converts the string representation to H3Index (uint64_t) representation.
Returns 0 on error.
<Tabs groupId="language" defaultValue="c" values={[ {label: 'C', value: 'c'}, {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, ] }> <TabItem value="c">
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.
</TabItem> </Tabs>Converts the H3Index representation of the index to the string representation. str must be at least of length 17.
<Tabs groupId="language" defaultValue="c" values={[ {label: 'C', value: 'c'}, {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, ] }> <TabItem value="c">
int h3IsValid(H3Index h);
h3.h3_is_valid(h)
boolean h3IsValid(long h3);
boolean h3IsValid(String h3Address);
h3.h3IsValid(h)
function example() {
const h = '85283473fffffff';
return h3v3.h3IsValid(h);
}
Returns non-zero if this is a valid H3 index.
<Tabs groupId="language" defaultValue="c" values={[ {label: 'C', value: 'c'}, {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, ] }> <TabItem value="c">
int h3IsResClassIII(H3Index h);
h3.h3_is_res_class_III(h)
boolean h3IsResClassIII(long h3);
boolean h3IsResClassIII(String h3Address);
h3.h3IsResClassIII(h)
function example() {
const h = '85283473fffffff';
return h3v3.h3IsResClassIII(h);
}
Returns non-zero if this index has a resolution with Class III orientation.
<Tabs groupId="language" defaultValue="c" values={[ {label: 'C', value: 'c'}, {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, ] }> <TabItem value="c">
int h3IsPentagon(H3Index h);
h3.h3_is_pentagon(h)
boolean h3IsPentagon(long h3);
boolean h3IsPentagon(String h3Address);
h3.h3IsPentagon(h)
function example() {
const h = '85283473fffffff';
return h3v3.h3IsPentagon(h);
}
Returns non-zero if this index represents a pentagonal cell.
<Tabs groupId="language" defaultValue="c" values={[ {label: 'C', value: 'c'}, {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, ] }> <TabItem value="c">
void h3GetFaces(H3Index h, int* out);
h3.h3_get_faces(h)
Collection<Integer> h3GetFaces(long h3);
Collection<Integer> h3GetFaces(String h3Address);
h3.h3GetFaces(h)
function example() {
const h = '85283473fffffff';
return h3v3.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.
<Tabs groupId="language" defaultValue="c" values={[ {label: 'C', value: 'c'}, {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, ] }> <TabItem value="c">
int maxFaceCount(H3Index h3);
:::note
This function exists for memory management and is not exposed.
:::
</TabItem> <TabItem value="java">:::note
This function exists for memory management and is not exposed.
:::
</TabItem> <TabItem value="javascript">:::note
This function exists for memory management and is not exposed.
:::
</TabItem> </Tabs>Returns the maximum number of icosahedron faces the given H3 index may intersect.