Vertex functions
Vertex mode allows encoding the topological vertexes of H3 cells.
cellToVertex
Returns the index for the specified cell vertex. Valid vertex numbers are between 0 and 5 (inclusive) for hexagonal cells, and 0 and 4 (inclusive) for pentagonal cells.
- C
- Java
- JavaScript (Live)
- Python
- Shell
H3Error cellToVertex(H3Index origin, int vertexNum, H3Index *out);
Returns 0 (E_SUCCESS
) on success.
Long cellToVertex(long origin, int vertexNum);
String cellToVertex(String origin, int vertexNum);
h3.cellToVertex(origin, vertexNum)
Live Editor
Result
Loading...
h3.cell_to_vertex(origin, vertex_num)
$ h3 cellToVertex --help
h3: Returns the vertex for the specified cell and vertex index. Must be 0-5 for hexagons, 0-4 for pentagons
H3 4.1.0
cellToVertex Returns the vertex for the specified cell and vertex index. Must be 0-5 for hexagons, 0-4 for pentagons
-c, --cell <index> Required. H3 Cell
-v, --vertex <INDEX> Required. Vertex index number. 0-5 for hexagons, 0-4 for pentagons
-h, --help Show this help message.
-f, --format <FMT> 'json' for "CELL"\n, 'newline' for CELL\n (Default: json)
$ h3 cellToVertex -v 2 -c 85283473fffffff
"205283463fffffff"
cellToVertexes
Returns the indexes for all vertexes of the given cell.
- C
- Java
- JavaScript (Live)
- Python
- Shell
H3Error cellToVertexes(H3Index origin, H3Index *out);
The length of the out
array must be 6.
If the given cell is a pentagon, one member of the
array will be set to 0
.
Returns 0 (E_SUCCESS
) on success.
List<Long> cellToVertexes(long origin);
List<String> cellToVertexes(String origin);
h3.cellToVertexes(origin)
Live Editor
Result
Loading...
h3.cell_to_vertexes(origin)
$ h3 cellToVertexes --help
h3: Returns all of the vertexes from the specified cell
H3 4.1.0
cellToVertexes Returns all of the vertexes from the specified cell
-c, --cell <index> Required. H3 Cell
-h, --help Show this help message.
-f, --format <FMT> 'json' for ["CELL", ...], 'newline' for CELL\n... (Default: json)
$ h3 cellToVertexes -c 85283473fffffff
[ "22528340bfffffff", "235283447fffffff", "205283463fffffff", "255283463fffffff", "22528340ffffffff", "23528340bfffffff" ]
vertexToLatLng
Returns the latitude and longitude coordinates of the given vertex.
- C
- Java
- JavaScript (Live)
- Python
- Shell
H3Error vertexToLatLng(H3Index vertex, LatLng *point);
Returns 0 (E_SUCCESS
) on success.
LatLng vertexToLatLng(long vertex);
LatLng vertexToLatLng(String vertex);
h3.vertexToLatLng(vertex)
Live Editor
Result
Loading...
h3.vertex_to_latlng(vertex)
$ h3 vertexToLatLng --help
h3: Returns the lat, lng pair for the given vertex
H3 4.1.0
vertexToLatLng Returns the lat, lng pair for the given vertex
-c, --cell <index> Required. H3 Cell
-h, --help Show this help message.
-f, --format <FMT> 'json' for [lat, lng], 'wkt' for a WKT POINT, 'newline' for lat\nlng\n (Default: json)
$ h3 vertexToLatLng -c 255283463fffffff
[37.4201286777, -122.0377349643]
isValidVertex
Determines if the given H3 index represents a valid H3 vertex.
- C
- Java
- JavaScript (Live)
- Python
- Shell
int isValidVertex(H3Index vertex);
Returns 1 if the given index represents a valid H3 vertex.
boolean isValidVertex(long vertex);
boolean isValidVertex(String vertex);
h3.isValidVertex(vertex)
Live Editor
Result
Loading...
h3.is_valid_vertex(vertex)
$ h3 isValidVertex --help
h3: Checks if the provided H3 vertex is actually valid
H3 4.1.0
isValidVertex Checks if the provided H3 vertex is actually valid
-h, --help Show this help message.
-c, --cell <index> Required. H3 Cell
-f, --format <FMT> 'json' for true or false, 'numeric' for 1 or 0 (Default: json)
$ h3 isValidVertex -c 255283463fffffff
true