---
id: inspection
title: Index inspection functions
sidebar_label: Inspection
slug: /api/inspection
---

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.

## getResolution

<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">

```c
int getResolution(H3Index h);
```

</TabItem>
<TabItem value="python">

```py
h3.get_resolution(h)
```

</TabItem>
<TabItem value="java">

```java
int getResolution(long h3);
int getResolution(String h3Address);
```

</TabItem>
<TabItem value="javascript">

```js
h3.getResolution(h)
```

```js live
function example() {
  const h = '85283473fffffff';
  return h3.getResolution(h);
}
```

</TabItem>
</Tabs>

Returns the resolution of the index.

## getBaseCellNumber

<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">

```c
int getBaseCellNumber(H3Index h);
```

</TabItem>
<TabItem value="python">

```py
h3.get_base_cell_number(h)
```

</TabItem>
<TabItem value="java">

```java
int getBaseCellNumber(long h3);
int getBaseCellNumber(String h3Address);
```

</TabItem>
<TabItem value="javascript">

```js
h3.getBaseCellNumber(h)
```

```js live
function example() {
  const h = '85283473fffffff';
  return h3.getBaseCellNumber(h);
}
```

</TabItem>
</Tabs>

Returns the base cell number of the index.

## stringToH3

<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">

```c
H3Error stringToH3(const char *str, H3Index *out);
```

</TabItem>
<TabItem value="python">

```py
h3.string_to_h3(h)
```

</TabItem>
<TabItem value="java">

```java
long stringToH3(String h3Address);
```

</TabItem>
<TabItem value="javascript">

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 (`E_SUCCESS`) on success.

## h3ToString

<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">

```c
H3Error h3ToString(H3Index h, char *str, size_t sz);
```

</TabItem>
<TabItem value="python">

```py
h3.h3_to_string(h)
```

</TabItem>
<TabItem value="java">

```java
String h3ToString(long h3);
```

</TabItem>
<TabItem value="javascript">

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.

Returns 0 (`E_SUCCESS`) on success.

## isValidCell

<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">

```c
int isValidCell(H3Index h);
```

</TabItem>
<TabItem value="python">

```py
h3.is_valid_cell(h)
```

</TabItem>
<TabItem value="java">

```java
boolean isValidCell(long h3);
boolean isValidCell(String h3Address);
```

</TabItem>
<TabItem value="javascript">

```js
h3.isValidCell(h)
```

```js live
function example() {
  const h = '85283473fffffff';
  return h3.isValidCell(h);
}
```

</TabItem>
</Tabs>

Returns non-zero if this is a valid H3 cell index.

## isResClassIII

<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">

```c
int isResClassIII(H3Index h);
```

</TabItem>
<TabItem value="python">

```py
h3.is_res_class_III(h)
```

</TabItem>
<TabItem value="java">

```java
boolean isResClassIII(long h3);
boolean isResClassIII(String h3Address);
```

</TabItem>
<TabItem value="javascript">

```js
h3.isResClassIII(h)
```

```js live
function example() {
  const h = '85283473fffffff';
  return h3.isResClassIII(h);
}
```

</TabItem>
</Tabs>

Returns non-zero if this index has a resolution with Class III orientation.

## isPentagon

<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">

```c
int isPentagon(H3Index h);
```

</TabItem>
<TabItem value="python">

```py
h3.is_pentagon(h)
```

</TabItem>
<TabItem value="java">

```java
boolean isPentagon(long h3);
boolean isPentagon(String h3Address);
```

</TabItem>
<TabItem value="javascript">

```js
h3.isPentagon(h)
```

```js live
function example() {
  const h = '85283473fffffff';
  return h3.isPentagon(h);
}
```

</TabItem>
</Tabs>

Returns non-zero if this index represents a pentagonal cell.

## getIcosahedronFaces

<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">

```c
H3Error getIcosahedronFaces(H3Index h, int* out);
```

</TabItem>
<TabItem value="python">

```py
h3.get_icosahedron_faces(h)
```

</TabItem>
<TabItem value="java">

```java
Collection<Integer> getIcosahedronFaces(long h3);
Collection<Integer> getIcosahedronFaces(String h3Address);
```

</TabItem>
<TabItem value="javascript">

```js
h3.getIcosahedronFaces(h)
```

```js live
function example() {
  const h = '85283473fffffff';
  return h3.getIcosahedronFaces(h);
}
```

</TabItem>
</Tabs>

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

<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">

```c
H3Error maxFaceCount(H3Index h3, int *out);
```

</TabItem>
<TabItem value="python">

:::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.
