### Verify H3 Filter Applications Source: https://h3geo.org/docs/installation Confirms that the H3 filter applications are working correctly by running an example command. This checks the functionality of tools like latLngToCell. ```shell ./bin/latLngToCell --lat 14 --lng -42 --resolution 2 ``` -------------------------------- ### Install H3 Extension for DuckDB Source: https://h3geo.org/docs/installation Installs the H3 extension for DuckDB, a in-process analytical data management system. This enables the use of H3 functions within DuckDB queries. ```sql INSTALL h3 FROM community; LOAD h3; ``` -------------------------------- ### Install H3 using Homebrew Source: https://h3geo.org/docs/3.x/installation Installs H3, including the C library and filter applications, using Homebrew, a package manager for macOS and Linux. This command installs the necessary binaries. ```shell brew install h3 ``` -------------------------------- ### Install H3 Build Dependencies on Debian/Ubuntu Source: https://h3geo.org/docs/3.x/installation Installs CMake, Make, GCC, Libtool, and optional development tools like clang-format, cmake-curses-gui, lcov, and doxygen on Debian/Ubuntu systems using apt. ```shell # Installing the bare build requirements sudo apt install cmake make gcc libtool # Installing useful tools for development sudo apt install clang-format cmake-curses-gui lcov doxygen ``` -------------------------------- ### Install H3 Build Dependencies on FreeBSD Source: https://h3geo.org/docs/3.x/installation Installs CMake, Make, GCC, Libtool, and optional development tools like clang-format, cmake-curses-gui, lcov, and doxygen on FreeBSD systems using pkg. ```shell # Installing the build requirements sudo pkg install bash cmake gmake doxygen lcov ``` -------------------------------- ### Install H3 JavaScript Package using Yarn Source: https://h3geo.org/docs/3.x/installation Installs the H3 JavaScript library using Yarn, a popular alternative package manager for JavaScript. It's known for its speed and reliability. ```shell yarn add h3-js ``` -------------------------------- ### JavaScript Example: getH3UnidirectionalEdge Source: https://h3geo.org/docs/3.x/api/uniedge Live editor example for the getH3UnidirectionalEdge function in JavaScript. This code demonstrates how to obtain a unidirectional edge H3 index given an origin and destination H3 index. ```javascript function example() { const origin = '85283473fffffff'; const destination = '85283477fffffff'; return h3v3.getH3UnidirectionalEdge(origin, destination); } ``` -------------------------------- ### Install H3 Python Package using Pip Source: https://h3geo.org/docs/3.x/installation Installs the H3 Python library using pip, a package installer for Python. This is a common method for adding Python dependencies to a project. ```shell pip install h3 ``` -------------------------------- ### JavaScript Example: Convert H3 Set to MultiPolygon Source: https://h3geo.org/docs/3.x/api/regions This JavaScript example shows how to use h3v3.h3SetToMultiPolygon to convert an array of H3 indexes into a GeoJSON-like MultiPolygon structure. ```javascript function example() { const hexagons = ['872830828ffffff', '87283082effffff']; return h3v3.h3SetToMultiPolygon(hexagons, true); } ``` -------------------------------- ### Install H3 Build Dependencies on Alpine Linux Source: https://h3geo.org/docs/3.x/installation Installs CMake, Make, GCC, Libtool, and musl-dev on Alpine Linux using the apk package manager. These are essential for building H3 from source on this distribution. ```shell # Installing the bare build requirements apk add cmake make gcc libtool musl-dev ``` -------------------------------- ### Install H3 JavaScript Package using npm Source: https://h3geo.org/docs/3.x/installation Installs the H3 JavaScript library using npm (Node Package Manager), the default package manager for the JavaScript runtime environment Node.js. ```shell npm install h3-js ``` -------------------------------- ### Clone H3 Repository and Checkout Version Source: https://h3geo.org/docs/3.x/installation Clones the H3 GitHub repository and checks out a specific release version. This is the first step for building H3 from source. ```shell git clone https://github.com/uber/h3.git cd h3 git checkout v$( h3Line(long start, long end) throws LineUndefinedException List h3Line(String startAddress, String endAddress) throws LineUndefinedException ``` ```javascript function example() { const start = '85283473fffffff'; const end = '8528342bfffffff'; return h3v3.h3Line(start, end); } ``` -------------------------------- ### Get Error Message from Exception (JavaScript) Source: https://h3geo.org/docs/api/misc Retrieves the human-readable error message from an H3 JavaScript exception. The example demonstrates a try-catch block to capture and return the error message, useful for debugging. ```javascript function example() { let errorMessage = "" try { h3.cellToChildrenSize("asdf", 9); } catch (e) { errorMessage = e.message; } return errorMessage; } ``` -------------------------------- ### Get Average Hexagon Edge Length in Kilometers (H3 Functions) Source: https://h3geo.org/docs/api/misc Retrieves the average hexagon edge length in kilometers for a given resolution, excluding pentagons. Examples cover C, Java, JavaScript, Python, Go, DuckDB, and shell. ```C H3Error getHexagonEdgeLengthAvgKm(int res, double *out); ``` ```Java double getHexagonEdgeLengthAvg(int res, LengthUnit unit); ``` ```JavaScript h3.getHexagonEdgeLengthAvg(res, h3.UNITS.km) ``` ```Python h3.average_hexagon_edge_length(res, unit='km') ``` ```Go h3.HexagonEdgeLengthAvgKm(res) ``` ```Shell $ h3 getHexagonEdgeLengthAvgKm --resolution ``` -------------------------------- ### Get Icosahedron Faces for H3 Cell (JavaScript) Source: https://h3geo.org/docs/api/inspection Finds all icosahedron faces intersected by a given H3 cell. Faces are represented as integers from 0-19. Expects an H3 index string as input. Example shown uses the Live Editor. ```javascript function example() { const h = '85283473fffffff'; return h3.getIcosahedronFaces(h); } ``` -------------------------------- ### Get Hexagons and Distances within Grid Distance k (Unsafe) - Python Source: https://h3geo.org/docs/api/traversal Python implementation for retrieving hexagons and their distances within a specified grid distance, with potential for pentagonal distortion. ```python h3_grid_disk_distances_unsafe(origin, k) ``` -------------------------------- ### Get H3 Indexes from Unidirectional Edge (C, Python, Java, JavaScript) Source: https://h3geo.org/docs/3.x/api/uniedge Retrieves the origin and destination H3 indexes for a given unidirectional edge ID. Supports C, Python, Java, and JavaScript, with a live editor example provided for JavaScript. ```c void getH3IndexesFromUnidirectionalEdge(H3Index edge, H3Index* originDestination); ``` ```python h3.get_h3_indexes_from_unidirectional_edge(edge) ``` ```java List getH3IndexesFromUnidirectionalEdge(long edge); List getH3IndexesFromUnidirectionalEdge(String edgeAddress); ``` ```javascript function example() { const edge = '115283473fffffff'; return h3v3.getH3IndexesFromUnidirectionalEdge(edge); } ``` -------------------------------- ### Get Exact Edge Length in Radians Source: https://h3geo.org/docs/api/misc Calculates the exact edge length of a specific unidirectional H3 edge in radians. This function requires an H3 index representing the edge. Examples are provided in C, Java, JavaScript, Python, Go, DuckDB, and Shell. ```C H3Error edgeLengthRads(H3Index edge, double *length); ``` ```Java double edgeLength(long h3, LengthUnit unit); double edgeLength(String h3Address, LengthUnit unit); ``` ```JavaScript function example() { const h = '115283473fffffff'; return h3.edgeLength(h, h3.UNITS.rads); } ``` ```Python h3.edge_length(h, unit='rads') ``` ```Go h3.EdgeLengthRads(edge) ``` ```DuckDB h3_edge_length(h, 'rads') ``` ```Shell $ h3 edgeLengthRads -c 115283473fffffff 0.0016158726 ``` -------------------------------- ### Get Exact Edge Length in Meters Source: https://h3geo.org/docs/api/misc Calculates the exact edge length of a specific unidirectional H3 edge in meters. This function requires an H3 index representing the edge. Examples are provided in C, Java, JavaScript, Python, Go, DuckDB, and Shell. ```C H3Error edgeLengthM(H3Index edge, double *length); ``` ```Java double edgeLength(long h3, LengthUnit unit); double edgeLength(String h3Address, LengthUnit unit); ``` ```JavaScript function example() { const h = '115283473fffffff'; return h3.edgeLength(h, h3.UNITS.m); } ``` ```Python h3.edge_length(h, unit='m') ``` ```Go h3.EdgeLengthM(edge) ``` ```DuckDB h3_edge_length(h, 'm') ``` ```Shell $ h3 edgeLengthM -c 115283473fffffff 10294.7360861995 ``` -------------------------------- ### Get Exact Edge Length in Kilometers Source: https://h3geo.org/docs/api/misc Calculates the exact edge length of a specific unidirectional H3 edge in kilometers. This function requires an H3 index representing the edge. Examples are provided in C, Java, JavaScript, Python, Go, DuckDB, and Shell. ```C H3Error edgeLengthKm(H3Index edge, double *length); ``` ```Java double edgeLength(long h3, LengthUnit unit); double edgeLength(String h3Address, LengthUnit unit); ``` ```JavaScript function example() { const h = '115283473fffffff'; return h3.edgeLength(h, h3.UNITS.km); } ``` ```Python h3.edge_length(h, unit='km') ``` ```Go h3.EdgeLengthKm(edge) ``` ```DuckDB h3_edge_length(h, 'km') ``` ```Shell $ h3 edgeLengthKm -c 115283473fffffff 10.2947360862 ``` -------------------------------- ### Get Child Cell by Position and Resolution (JavaScript) Source: https://h3geo.org/docs/api/hierarchy In JavaScript, this function calculates the child H3 cell given a parent cell, a child position, and the desired resolution. It's often used with an H3 library instance. An example demonstrates its usage with live editor integration. ```javascript function example() { const parent = '85283473fffffff'; const childPos = 42; return h3.childPosToCell(childPos, parent, 7); } ``` ```javascript h3.childPosToCell(childPos, parent, childRes); ``` -------------------------------- ### Get H3 Cell Boundary Coordinates (JavaScript) Source: https://h3geo.org/docs/quickstart Returns the coordinates that define the boundary of a given H3 cell identifier. This function is useful for visualizing H3 cells or performing spatial operations. It takes an H3 identifier string as input and returns an array of coordinate pairs representing the cell's vertices. ```javascript function example() { const h = '8a283082a677fff'; return h3.cellToBoundary(h); } ``` -------------------------------- ### Add H3 Java Dependency using Gradle Source: https://h3geo.org/docs/3.x/installation Adds the H3 Java library as a dependency to a Gradle project. Gradle is a build automation tool that supports various languages, including Java. ```gradle compile("com.uber:h3:3.7.1") ``` -------------------------------- ### Add H3 Java Dependency using Maven Source: https://h3geo.org/docs/3.x/installation Adds the H3 Java library as a dependency to a Maven project by including it in the pom.xml file. Maven is a popular build automation tool for Java projects. ```xml com.uber h3 3.7.1 ``` -------------------------------- ### Compact H3 Cells (H3 CLI) Source: https://h3geo.org/docs/api/hierarchy The H3 command-line tool provides a `compactCells` command to compact a set of H3 cells. Input cells must share the same resolution. Cells can be provided directly or read from a file. ```shell $ h3 compactCells --help h3: Compacts the provided set of cells as best as possible. The set of input cells must all share the same resolution. H3 4.1.0 compactCells Compacts the provided set of cells as best as possible. The set of input cells must all share the same resolution. -h, --help Show this help message. -i, --file The file to load the cells from. Use -- to read from stdin. -c, --cells The cells to compact. Up to 100 cells if provided as hexadecimals with zero padding. -f, --format 'json' for ["CELL", ...], 'newline' for CELL\n... (Default: json) ``` ```shell $ h3 compactCells -c 85283473fffffff,85283447fffffff,8528347bfffffff,85283463fffffff,85283477fffffff,8528340ffffffff,8528340bfffffff,85283457fffffff,85283443fffffff,8528344ffffffff,852836b7fffffff,8528346bfffffff,8528346ffffffff,85283467fffffff,8528342bfffffff,8528343bfffffff,85283407fffffff,85283403fffffff,8528341bfffffff [ "85283447fffffff", "8528340ffffffff", "8528340bfffffff", "85283457fffffff", "85283443fffffff", "8528344ffffffff", "852836b7fffffff", "8528342bfffffff", "8528343bfffffff", "85283407fffffff", "85283403fffffff", "8528341bfffffff", "8428347ffffffff" ] ``` -------------------------------- ### H3 CLI Grid Disk Command Source: https://h3geo.org/docs/api/traversal Command-line interface for generating the H3 grid disk. ```APIDOC ## Shell Command ### Description Returns an array of H3 cells within 'k' steps of the origin cell. ### Method `h3 gridDisk` ### Usage `$ h3 gridDisk -k -c [--format ]` ### Parameters #### Path Parameters - `-c, --cell ` (String) - Required. The H3 Cell index. - `-k ` (Integer) - Required. Maximum grid distance for the output set. - `-f, --format ` (String) - Optional. Output format. 'json' for ["CELL", ...], 'newline' for CELL\n... (Default: json) ### Example ```bash $ h3 gridDisk -k 5 -c 85283473fffffff ``` ### Response #### Success Response (JSON format) Returns a JSON array of H3 cell indices within the specified distance. ``` -------------------------------- ### Construct H3 Cell from Components (CLI) Source: https://h3geo.org/docs/api/inspection Constructs an H3 cell from resolution, base cell number, and digits via the command-line interface. The resolution can be inferred from the digits if not explicitly provided. Output format can be JSON or newline-delimited. An example demonstrates constructing a cell with specific parameters. ```Shell $ h3 constructCell --help Usage: h3 constructCell [OPTION]... Construct an H3 cell from resolution, base cell, and digits Options: -h, --help Show this help message. -r, --resolution Resolution, 0-15 inclusive. Inferred from digits if not provided. -b, --baseCell Required. Base cell number, 0-121 inclusive. -d, --digits Comma-separated list of child digits (0-6) of length resolution. -f, --format 'json' for "CELL"\n, 'newline' for CELL\n (Default: json) $ h3 constructCell -r 3 -b 73 -d 1,2,3 "839253fffffffff" ``` -------------------------------- ### Configure H3 with Custom Memory Allocators (CMake) Source: https://h3geo.org/docs/3.x/core-library/custom-alloc This snippet shows how to configure the H3 build process to use custom memory allocation functions by setting the H3_ALLOC_PREFIX CMake variable. This is necessary on systems where symbols cannot be undefined at build time. ```bash cmake -DH3_ALLOC_PREFIX=my_prefix_ . ``` -------------------------------- ### JavaScript: Calculate H3 Cell Boundary Source: https://h3geo.org/docs/api/indexing In JavaScript, the cellToBoundary function calculates the boundary of an H3 cell. It can optionally format the output, for example, as GeoJSON. The live editor example demonstrates a typical usage. ```javascript function example() { const cell = '85283473fffffff'; return h3.cellToBoundary(cell); } ``` -------------------------------- ### Uncompact H3 Cell Sets to a Specific Resolution (Shell) Source: https://h3geo.org/docs/api/hierarchy Shell command-line interface for uncompacting H3 cell sets. This example demonstrates uncompacting cells provided via the -c flag to resolution 5, outputting results in JSON format. ```bash $ h3 uncompactCells -r 5 -c 85283447fffffff,8528340ffffffff,8528340bfffffff,85283457fffffff,85283443fffffff,8528344ffffffff,852836b7fffffff,8528342bfffffff,8528343bfffffff,85283407fffffff,85283403fffffff,8528341bfffffff,8428347ffffffff [ "85283447fffffff", "8528340ffffffff", "8528340bfffffff", "85283457fffffff", "85283443fffffff", "8528344ffffffff", "852836b7fffffff", "8528342bfffffff", "8528343bfffffff", "85283407fffffff", "85283403fffffff", "8528341bfffffff", "85283463fffffff", "85283467fffffff", "8528346bfffffff", "8528346ffffffff", "85283473fffffff", "85283477fffffff", "8528347bfffffff" ] ``` -------------------------------- ### Python: PolygonToCellsExperimental Constructor Source: https://h3geo.org/docs/api/regions The Python `PolygonToCellsExperimental` class can be instantiated with a polygon, resolution, containment mode, and an optional maximum number of cells to return. It provides fine-grained control over the cell generation process. ```python h3.PolygonToCellsExperimental(polygon, res, containmentMode, maxNumCellsReturn) ``` -------------------------------- ### JavaScript Example: h3UnidirectionalEdgeIsValid Source: https://h3geo.org/docs/3.x/api/uniedge Live editor example for validating a unidirectional edge in JavaScript. This snippet shows how to use h3UnidirectionalEdgeIsValid to determine if a given H3 index represents a valid unidirectional edge. ```javascript function example() { const edge = '115283473fffffff'; return String(h3v3.h3UnidirectionalEdgeIsValid(edge)); } ``` -------------------------------- ### Get Directed Edge Destination - Shell Source: https://h3geo.org/docs/api/uniedge Uses the H3 CLI to get the destination hexagon H3Index from a directed edge H3Index. The command requires the edge index as an argument and supports JSON or newline formatting for the output. ```bash $ h3 getDirectedEdgeDestination --help h3: Returns the destination cell from the directed edge H3 4.1.0 getDirectedEdgeDestination Returns the destination cell from the directed edge -c, --cell Required. H3 Cell -h, --help Show this help message. -f, --format 'json' for "CELL"\n, 'newline' for CELL\n (Default: json) $ h3 getDirectedEdgeDestination -c 115283473fffffff "85283477fffffff" ``` -------------------------------- ### Compact H3 Cells (Go) Source: https://h3geo.org/docs/api/hierarchy The Go implementation of `CompactCells` handles the compaction of a collection of H3 cell indices, aiming to replace smaller cells with their larger parent cells where possible. ```go h3.CompactCells(cells) ``` -------------------------------- ### Get Directed Edge Origin - Shell Source: https://h3geo.org/docs/api/uniedge Uses the H3 CLI to get the origin hexagon H3Index from a directed edge H3Index. The command requires the edge index as an argument and supports JSON or newline formatting for the output. ```bash $ h3 getDirectedEdgeOrigin --help h3: Returns the origin cell from the directed edge H3 4.1.0 getDirectedEdgeOrigin Returns the origin cell from the directed edge -c, --cell Required. H3 Cell -h, --help Show this help message. -f, --format 'json' for "CELL"\n, 'newline' for CELL\n (Default: json) $ h3 getDirectedEdgeOrigin -c 115283473fffffff "85283473fffffff" ``` -------------------------------- ### Get Directed Edge Cells - Shell Source: https://h3geo.org/docs/api/uniedge Uses the H3 CLI to get the origin and destination hexagon H3Indexes from a directed edge H3Index. The command requires the edge index as an argument and supports JSON or newline formatting for the output, returning both cells. ```bash $ h3 directedEdgeToCells --help h3: Returns the origin, destination pair of cells from the directed edge H3 4.1.0 directedEdgeToCells Returns the origin, destination pair of cells from the directed edge -c, --cell Required. H3 Cell -h, --help Show this help message. -f, --format 'json' for ["CELL", ...], 'newline' for CELL\n... (Default: json) $ h3 directedEdgeToCells -c 115283473fffffff ["85283473fffffff", "85283477fffffff"] ``` -------------------------------- ### Get H3 k-ring distances in C, Python, Java, JavaScript Source: https://h3geo.org/docs/3.x/api/traversal Calculates all H3 indexes within a specified distance 'k' from an origin index. Output is placed in provided arrays and may be zero for pentagons. Supported in C, Python, Java, and JavaScript. ```c void kRingDistances(H3Index origin, int k, H3Index* out, int* distances); ``` ```python h3.k_ring_distances(origin, k) ``` ```java List> kRingDistances(long origin, int k); List> kRingDistances(String origin, int k); ``` ```javascript function example() { const h = '85283473fffffff'; const k = 5; return h3v3.kRingDistances(h, k); } ``` -------------------------------- ### Convert GeoJSON-like data to H3 hexagons (C) Source: https://h3geo.org/docs/3.x/api/regions The C version of polyfill takes a GeoPolygon pointer, a resolution, and a preallocated buffer to fill with H3 indexes. It determines containment based on cell centroids. ```c void polyfill(const GeoPolygon* geoPolygon, int res, H3Index* out); ``` -------------------------------- ### Implement Custom Memory Allocator Functions (C) Source: https://h3geo.org/docs/3.x/core-library/custom-alloc Defines the expected custom memory allocation functions that an application must implement when H3 is built with a custom allocator prefix. These functions replace the standard C memory allocation functions used by H3. ```c void* my_prefix_malloc(size_t size); void* my_prefix_calloc(size_t num, size_t size); void* my_prefix_realloc(void* ptr, size_t size); void my_prefix_free(void* ptr); ``` -------------------------------- ### Convert GeoJSON-like data to H3 hexagons (Python) Source: https://h3geo.org/docs/3.x/api/regions The Python polyfill function takes a list of polygons, a resolution, and an optional flag for GeoJSON conformity. It returns a list of H3 indexes that cover the input polygons. ```python h3.polyfill(polygons, res, geo_json_conformant=False) ``` -------------------------------- ### Get Hexagons within Grid Distance k (Unsafe) - Java Source: https://h3geo.org/docs/api/traversal Java implementation of gridDiskUnsafe. Throws PentagonEncounteredException if pentagonal distortion is detected. ```java List> gridDiskUnsafe(Long h3, int k) throws PentagonEncounteredException; List> gridDiskUnsafe(String h3Address, int k) throws PentagonEncounteredException; ``` -------------------------------- ### Convert H3 set to polygonal outlines (Java) Source: https://h3geo.org/docs/3.x/api/regions The Java h3SetToMultiPolygon and h3AddressSetToMultiPolygon functions convert a collection of H3 indexes (as Long or String) into a list of lists of GeoCoord points, representing MultiPolygon structures. The geoJson parameter determines the output format. ```java List>> h3SetToMultiPolygon(Collection h3, boolean geoJson); List>> h3AddressSetToMultiPolygon(Collection h3Addresses, boolean geoJson); ``` -------------------------------- ### Generate H3 hex range in C, Python, Java, JavaScript Source: https://h3geo.org/docs/3.x/api/traversal Generates H3 indexes within a specified distance 'k' from an origin index. Output order is by increasing distance. Behavior is undefined for pentagons. Supported in C, Python, Java, and JavaScript, though not directly exposed in all. ```c int hexRange(H3Index origin, int k, H3Index* out); ``` ```python h3.hex_range(h, k) ``` ```java List> hexRange(Long h3, int k) throws PentagonEncounteredException; List> hexRange(String h3Address, int k) throws PentagonEncounteredException; ``` -------------------------------- ### Get Pentagon H3 Cell Addresses (DuckDB) Source: https://h3geo.org/docs/api/misc Retrieves all pentagon H3 cells for a specified resolution using DuckDB and returns them as string representations. ```sql h3_get_pentagons_string(res) ``` -------------------------------- ### Get Pentagon H3 Cells (Shell) Source: https://h3geo.org/docs/api/misc Command-line interface to retrieve all pentagon H3 cells at a specified resolution. Supports JSON or newline-delimited output formats. ```bash $ h3 getPentagons --help h3: Returns all of the pentagons at the specified resolution H3 4.1.0 getPentagons Returns all of the pentagons at the specified resolution -r, --resolution Required. Resolution, 0-15 inclusive. -h, --help Show this help message. -f, --format 'json' for ["CELL", ...], 'newline' for CELL\n... (Default: json) $ h3 getPentagons -r 5 [ "85080003fffffff", "851c0003fffffff", "85300003fffffff", "854c0003fffffff", "85620003fffffff", "85740003fffffff", "857e0003fffffff", "85900003fffffff", "85a60003fffffff", "85c20003fffffff", "85d60003fffffff", "85ea0003fffffff" ] ``` -------------------------------- ### experimentalLocalIjToH3 Source: https://h3geo.org/docs/3.x/api/traversal Converts local IJ coordinates to an H3 index, using a specified origin H3 index as the anchor. This is an experimental function, and its results may change between H3 versions. ```APIDOC ## experimentalLocalIjToH3 ### Description Produces an H3 index from local IJ coordinates anchored by an origin. This function is experimental, and its output is not guaranteed to be compatible across different versions of H3. ### Method Not applicable (this is a library function, not an HTTP endpoint) ### Endpoint Not applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript function example() { const h = '85283473fffffff'; const coords = {i: 0, j: 0}; return h3v3.experimentalLocalIjToH3(h, coords); } ``` ### Response #### Success Response (200) - **h3Index** (string) - The resulting H3 index. #### Response Example ```json "85280003fffffff" ``` ``` -------------------------------- ### Get Pentagon H3 Cells (Go) Source: https://h3geo.org/docs/api/misc Retrieves all pentagon H3 cells for a specified resolution using Go. This function returns a slice of H3 indices. ```go h3.Pentagons(res) ``` -------------------------------- ### Get Pentagon H3 Cell Addresses Source: https://h3geo.org/docs/api/misc Retrieves all pentagon H3 cells at a specified resolution and returns them as a collection of H3 index objects or their string representations. ```java Collection h3.getPentagons(int res); Collection h3.getPentagonsAddresses(int res); ``` -------------------------------- ### Generate H3 Cells within Grid Distance k (Go) Source: https://h3geo.org/docs/api/traversal The Go implementation of gridDisk takes an H3Index and an integer 'k' for the distance. It returns a slice of H3Index containing cells within the specified grid distance from the origin. ```go cell.GridDisk(k) ``` -------------------------------- ### Convert Local IJ Coordinates to H3 Index (Shell) Source: https://h3geo.org/docs/api/traversal The H3 CLI tool's `localIjToCell` command converts local IJ coordinates to an H3 index, anchored by an origin cell. It requires the origin, i, and j values, and supports JSON or newline output formats. ```bash $ h3 localIjToCell --help h3: Returns the H3 index from a local IJ coordinate anchored to an origin cell H3 4.1.0 localIjToCell Returns the H3 index from a local IJ coordinate anchored to an origin cell -h, --help Show this help message. -o, --origin Required. The origin H3 cell -i Required. The I dimension of the IJ coordinate -j Required. The J dimension of the IJ coordinate -f, --format 'json' for "CELL"\n, 'newline' for CELL\n (Default: json) $ h3 localIjToCell -o 85283473fffffff -i 0 -j 0 "85280003fffffff" ``` -------------------------------- ### Get Resolution 0 Cells in Java Source: https://h3geo.org/docs/api/misc Obtains resolution 0 H3 cells in Java, returning them as a collection of `Long` indices or a collection of their string representations. ```java Collection getRes0Cells(); Collection getRes0CellAddresses(); ``` -------------------------------- ### DuckDB: Convert H3 Cell to Boundary Source: https://h3geo.org/docs/api/indexing DuckDB supports H3 functions, including `h3_cell_to_boundary_wkt` and `h3_cell_to_boundary_wkb`, to convert an H3 cell index into its boundary representation in Well-Known Text (WKT) or Well-Known Binary (WKB) formats, respectively. ```sql h3_cell_to_boundary_wkt(cell) h3_cell_to_boundary_wkb(cell) ``` -------------------------------- ### getPentagonIndexes Source: https://h3geo.org/docs/3.x/api/misc Retrieves all pentagonal H3 indexes for a given resolution. The output array must be pre-allocated to accommodate all pentagon indexes for that resolution. ```APIDOC ## GET /websites/h3geo/getPentagonIndexes ### Description Retrieves all pentagonal H3 indexes at the specified resolution. The `out` parameter must be a pre-allocated array of sufficient size (determined by `pentagonIndexCount()`). ### Method GET ### Endpoint /websites/h3geo/getPentagonIndexes ### Parameters #### Path Parameters None #### Query Parameters - **res** (Integer) - Required - The H3 resolution for which to retrieve pentagon indexes. #### Request Body None ### Request Example ```json { "example": "No request body for this endpoint." } ``` ### Response #### Success Response (200) - **out** (Array) - An array containing the pentagonal H3 indexes for the specified resolution. #### Response Example ```json { "example": [ "85080003fffffff", "851c0003fffffff", "85300003fffffff" // ... more indexes ] } ``` ``` -------------------------------- ### Convert GeoJSON-like data to H3 hexagons (JavaScript) Source: https://h3geo.org/docs/3.x/api/regions The JavaScript polyfill function takes a polygon, a resolution, and a boolean indicating GeoJSON format. It returns an array of H3 indexes. ```javascript h3.polyfill(polygon, res, isGeoJson) ``` -------------------------------- ### Get Pentagon H3 Cells (DuckDB) Source: https://h3geo.org/docs/api/misc Retrieves all pentagon H3 cells for a specified resolution using DuckDB. This function is available as a user-defined function within DuckDB. ```sql h3_get_pentagons(res) ``` -------------------------------- ### Convert H3 set to polygonal outlines (JavaScript) Source: https://h3geo.org/docs/3.x/api/regions The JavaScript h3SetToMultiPolygon function takes a collection of H3 indexes and a boolean indicating GeoJSON format, returning a MultiPolygon representation of the hexagons. ```javascript h3.h3SetToMultiPolygon(polygon, geoJson) ``` -------------------------------- ### Get Pentagon H3 Cells (Python) Source: https://h3geo.org/docs/api/misc Retrieves all pentagon H3 cells for a specified resolution using Python. The function returns a list of H3 index values. ```python h3.get_pentagons(res) ``` -------------------------------- ### Get H3 Index Boundary (Java) Source: https://h3geo.org/docs/3.x/api/indexing Retrieves the boundary of an H3 index. This Java function returns a List of GeoCoord objects representing the vertices of the H3 cell. ```java List h3ToGeoBoundary(long h3); List h3ToGeoBoundary(String h3Address); ``` -------------------------------- ### polygonToCellsExperimental (Other Bindings) Source: https://h3geo.org/docs/api/regions Documentation for polygonToCellsExperimental function in various other bindings like DuckDB and Shell. ```APIDOC ## polygonToCellsExperimental (Other Bindings) ### Description Provides functionality to convert polygons to H3 cells across different environments including DuckDB and Shell. ### Method `h3_polygon_wkt_to_cells_experimental`, `h3_polygon_wkt_to_cells_experimental_string`, `h3_polygon_wkb_to_cells_experimental`, `h3_polygon_wkb_to_cells_experimental_string` ### Endpoint N/A (Command-line or specific environment functions) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body Parameters often include: - **wkt/wkb** (string/bytes) - Well-Known Text or Well-Known Binary representation of the polygon. - **res** (int) - The target H3 resolution. - **contain** (string, optional) - Containment mode. Valid values: `'center'` (default), `'full'`, `'overlap'`, `'bbox_overlap'`. ### Request Example (Shell/CLI examples - specific syntax may vary) ```bash # Example for WKT input h3_polygon_wkt_to_cells_experimental 'POLYGON ((...))' 7 'overlap' # Example for WKB input h3_polygon_wkb_to_cells_experimental 7 'overlap' ``` ### Response #### Success Response - **Returns a collection of H3 indices.** The format (e.g., list of strings, comma-separated) might depend on the specific binding. #### Response Example (Conceptual output) ``` 87283080cffffff,87283080dffffff,... ``` ``` -------------------------------- ### Get H3 Index Boundary (Python) Source: https://h3geo.org/docs/3.x/api/indexing Returns the geographic boundary of an H3 index. This Python function can output the boundary as a list of coordinate pairs or in GeoJSON format. ```python h3.h3_to_geo_boundary(h, geo_json=False) ```