From d6839592bff180344af5254c067b7ec5e0f0a4d3 Mon Sep 17 00:00:00 2001 From: David Ellis Date: Mon, 14 Oct 2024 14:50:19 -0500 Subject: [PATCH 1/5] Add shell docs for the H3 CLI --- website/docs/api/directededge.mdx | 282 +++++++++--- website/docs/api/hierarchy.mdx | 330 +++++++++++--- website/docs/api/indexing.mdx | 107 ++++- website/docs/api/inspection.mdx | 268 +++++++++--- website/docs/api/misc.mdx | 702 +++++++++++++++++++++++------- website/docs/api/regions.mdx | 126 +++++- website/docs/api/traversal.mdx | 400 +++++++++++++---- website/docs/api/vertex.mdx | 141 ++++-- 8 files changed, 1827 insertions(+), 529 deletions(-) diff --git a/website/docs/api/directededge.mdx b/website/docs/api/directededge.mdx index 4e0aab1f2..48799b9c1 100644 --- a/website/docs/api/directededge.mdx +++ b/website/docs/api/directededge.mdx @@ -18,9 +18,10 @@ edge from one cell to a neighboring cell. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -29,13 +30,6 @@ edge from one cell to a neighboring cell. H3Error areNeighborCells(H3Index origin, H3Index destination, int *out); ``` - - - -```py -h3.are_neighbor_cells(origin, destination) -``` - @@ -59,6 +53,32 @@ function example() { } ``` + + + +```py +h3.are_neighbor_cells(origin, destination) +``` + + + + +```sh +$ h3 areNeighborCells --help +h3: Determines if the provided H3 cells are neighbors (have a shared border) +H3 4.1.0 + + areNeighborCells Determines if the provided H3 cells are neighbors (have a shared border) + -o, --origin Required. Origin H3 Cell + -d, --destination Required. Destination H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 areNeighborCells -o 85283473fffffff -d 85283477fffffff +true +``` + @@ -73,9 +93,10 @@ Returns whether or not the provided H3 cell indexes are neighbors. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -84,13 +105,6 @@ Returns whether or not the provided H3 cell indexes are neighbors. H3Error cellsToDirectedEdge(H3Index origin, H3Index destination, H3Index *out); ``` - - - -```py -h3.cells_to_directed_edge(origin, destination) -``` - @@ -114,6 +128,32 @@ function example() { } ``` + + + +```py +h3.cells_to_directed_edge(origin, destination) +``` + + + + +```sh +$ h3 cellsToDirectedEdge --help +h3: Converts neighboring cells into a directed edge index (or errors if they are not neighbors) +H3 4.1.0 + + cellsToDirectedEdge Converts neighboring cells into a directed edge index (or errors if they are not neighbors) + -o, --origin Required. Origin H3 Cell + -d, --destination Required. Destination H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 cellsToDirectedEdge -o 85283473fffffff -d 85283477fffffff +115283473fffffff +``` + @@ -129,9 +169,10 @@ Returns 0 on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -140,13 +181,6 @@ Returns 0 on success. int isValidDirectedEdge(H3Index edge); ``` - - - -```py -h3.is_valid_directed_edge(edge) -``` - @@ -169,6 +203,31 @@ function example() { } ``` + + + +```py +h3.is_valid_directed_edge(edge) +``` + + + + +```sh +$ h3 isValidDirectedEdge --help +h3: Checks if the provided H3 directed edge is actually valid +H3 4.1.0 + + isValidDirectedEdge Checks if the provided H3 directed edge is actually valid + -h, --help Show this help message. + -c, --cell Required. H3 Cell +``` + +```bash +$ h3 isValidDirectedEdge -c 115283473fffffff +true +``` + @@ -183,9 +242,10 @@ Returns 1 if it is a unidirectional edge H3Index, otherwise 0. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -194,13 +254,6 @@ Returns 1 if it is a unidirectional edge H3Index, otherwise 0. H3Error getDirectedEdgeOrigin(H3Index edge, H3Index *out); ``` - - - -```py -h3.get_directed_edge_origin(edge) -``` - @@ -223,6 +276,31 @@ function example() { } ``` + + + +```py +h3.get_directed_edge_origin(edge) +``` + + + + +```sh +$ 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. +``` + +```bash +$ h3 getDirectedEdgeOrigin -c 115283473fffffff +85283473fffffff +``` + @@ -235,9 +313,10 @@ Returns the origin hexagon from the unidirectional edge H3Index. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -246,13 +325,6 @@ Returns the origin hexagon from the unidirectional edge H3Index. H3Error getDirectedEdgeDestination(H3Index edge, H3Index *out); ``` - - - -```py -h3.get_directed_edge_destination(edge) -``` - @@ -275,6 +347,31 @@ function example() { } ``` + + + +```py +h3.get_directed_edge_destination(edge) +``` + + + + +```sh +$ 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. +``` + +```bash +$ h3 getDirectedEdgeDestination -c 115283473fffffff +85283477fffffff +``` + @@ -287,9 +384,10 @@ Returns the destination hexagon from the unidirectional edge H3Index. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -298,13 +396,6 @@ Returns the destination hexagon from the unidirectional edge H3Index. H3Error directedEdgeToCells(H3Index edge, H3Index* originDestination); ``` - - - -```py -h3.directed_edge_to_cells(edge) -``` - @@ -327,6 +418,31 @@ function example() { } ``` + + + +```py +h3.directed_edge_to_cells(edge) +``` + + + + +```sh +$ 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. +``` + +```bash +$ h3 directedEdgeToCells -c 115283473fffffff +[85283473fffffff, 85283477fffffff] +``` + @@ -340,9 +456,10 @@ Returns the origin, destination pair of hexagon IDs for the given edge ID, which defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -351,13 +468,6 @@ Returns the origin, destination pair of hexagon IDs for the given edge ID, which H3Error originToDirectedEdges(H3Index origin, H3Index* edges); ``` - - - -```py -h3.origin_to_directed_edges(h) -``` - @@ -380,6 +490,31 @@ function example() { } ``` + + + +```py +h3.origin_to_directed_edges(h) +``` + + + + +```sh +$ h3 originToDirectedEdges --help +h3: Returns all of the directed edges from the specified origin cell +H3 4.1.0 + + originToDirectedEdges Returns all of the directed edges from the specified origin cell + -c, --cell Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 originToDirectedEdges -c 85283473fffffff +[115283473fffffff, 125283473fffffff, 135283473fffffff, 145283473fffffff, 155283473fffffff, 165283473fffffff] +``` + @@ -394,9 +529,10 @@ one of the members of the array will be `0`. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -405,13 +541,6 @@ one of the members of the array will be `0`. H3Error directedEdgeToBoundary(H3Index edge, CellBoundary* gb); ``` - - - -```py -h3.directed_edge_to_boundary(edge, geo_json=False) -``` - @@ -434,6 +563,31 @@ function example() { } ``` + + + +```py +h3.directed_edge_to_boundary(edge, geo_json=False) +``` + + + + +```sh +$ h3 directedEdgeToBoundary --help +h3: Provides the coordinates defining the directed edge +H3 4.1.0 + + directedEdgeToBoundary Provides the coordinates defining the directed edge + -c, --cell Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 directedEdgeToBoundary -c 115283473fffffff +POLYGON((-122.0377349643 37.4201286777, -122.0904289290 37.3375560844, -122.0377349643 37.4201286777)) +``` + diff --git a/website/docs/api/hierarchy.mdx b/website/docs/api/hierarchy.mdx index 76e64ac05..6ca5012a6 100644 --- a/website/docs/api/hierarchy.mdx +++ b/website/docs/api/hierarchy.mdx @@ -17,9 +17,10 @@ These functions permit moving between resolutions in the H3 grid system. The fun defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -28,13 +29,6 @@ These functions permit moving between resolutions in the H3 grid system. The fun H3Error cellToParent(H3Index cell, int parentRes, H3Index *parent); ``` - - - -```py -h3.cell_to_parent(cell, parent_res) -``` - @@ -57,6 +51,32 @@ function example() { } ``` + + + +```py +h3.cell_to_parent(cell, parent_res) +``` + + + + +```sh +$ h3 cellToParent --help +h3: Returns the H3 index that is the parent (or higher) of the provided cell +H3 4.1.0 + + cellToParent Returns the H3 index that is the parent (or higher) of the provided cell + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -r, --resolution Required. Resolution, 0-14 inclusive, excluding 15 as it can never be a parent +``` + +```bash +$ h3 cellToParent -c 85283473fffffff -r 4 +8428347ffffffff +``` + @@ -71,9 +91,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -82,13 +103,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Error cellToChildren(H3Index cell, int childRes, H3Index *children); ``` - - - -```py -h3.cell_to_children(cell, child_res) -``` - @@ -111,6 +125,32 @@ function example() { } ``` + + + +```py +h3.cell_to_children(cell, child_res) +``` + + + + +```sh +$ h3 cellToChildren --help +h3: Returns a JSON array of H3 indexes that are the children (or lower) of the provided cell +H3 4.1.0 + + cellToChildren Returns a JSON array of H3 indexes that are the children (or lower) of the provided cell + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -r, --resolution Required. Resolution, 1-15 inclusive, excluding 0 as it can never be a child +``` + +```bash +$ h3 cellToChildren -c 85283473fffffff -r 6 +[ "862834707ffffff", "86283470fffffff", "862834717ffffff", "86283471fffffff", "862834727ffffff", "86283472fffffff", "862834737ffffff" ] +``` + @@ -125,9 +165,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -137,7 +178,7 @@ H3Error cellToChildrenSize(H3Index cell, int childRes, int64_t *out); ``` - + :::note @@ -146,7 +187,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -155,7 +196,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -163,6 +204,25 @@ This function exists for memory management and is not exposed. ::: + + + +```sh +$ h3 cellToChildrenSize --help +h3: Returns the maximum number of children for a given cell at the specified child resolution +H3 4.1.0 + + cellToChildrenSize Returns the maximum number of children for a given cell at the specified child resolution + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -r, --resolution Required. Resolution, 1-15 inclusive, excluding 0 as it can never be a child +``` + +```bash +$ h3 cellToChildrenSize -c 85283473fffffff -r 6 +7 +``` + @@ -177,9 +237,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -188,13 +249,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Error cellToCenterChild(H3Index cell, int childRes, H3Index *child); ``` - - - -```py -h3.cell_to_center_child(cell, child_res) -``` - @@ -217,6 +271,32 @@ function example() { } ``` + + + +```py +h3.cell_to_center_child(cell, child_res) +``` + + + + +```sh +$ h3 cellToCenterChild --help +h3: Returns the H3 index that is the centrally-placed child (or lower) of the provided cell +H3 4.1.0 + + cellToCenterChild Returns the H3 index that is the centrally-placed child (or lower) of the provided cell + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -r, --resolution Required. Resolution, 1-15 inclusive, excluding 0 as it can never be a child +``` + +```bash +$ h3 cellToCenterChild -c 85283473fffffff -r 7 +872834700ffffff +``` + @@ -231,9 +311,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -242,13 +323,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Index cellToChildPos(H3Index child, int parentRes, int64_t *out); ``` - - - -```py -h3.cell_to_child_pos(child, parent_res) -``` - @@ -271,6 +345,32 @@ function example() { } ``` + + + +```py +h3.cell_to_child_pos(child, parent_res) +``` + + + + +```sh +$ h3 cellToChildPos --help +h3: Returns the position of the child cell within an ordered list of all children of the cell's parent at the specified child resolution +H3 4.1.0 + + cellToChildPos Returns the position of the child cell within an ordered list of all children of the cell's parent at the specified child resolution + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -r, --resolution Required. Resolution, 1-15 inclusive, excluding 0 as it can never be a child +``` + +```bash +$ h3 cellToChildPos -c 85283473fffffff -r 3 +25 +``` + @@ -285,9 +385,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -296,13 +397,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Index childPosToCell(int64_t childPos, H3Index parent, int childRes, H3Index *child); ``` - - - -```py -h3.cell_to_child_pos(child_pos, parent, child_res) -``` - @@ -326,6 +420,33 @@ function example() { } ``` + + + +```py +h3.child_pos_to_cell(child_pos, parent, child_res) +``` + + + + +```sh +$ h3 childPosToCell --help +h3: Returns the child cell at a given position and resolution within an ordered list of all children of the parent cell +H3 4.1.0 + + childPosToCell Returns the child cell at a given position and resolution within an ordered list of all children of the parent cell + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -r, --resolution Required. Resolution, 1-15 inclusive, excluding 0 as it can never be a child + -p, --position Required. The child position within the set of children of the parent cell +``` + +```bash +$ h3 childPosToCell -p 42 -c 85283473fffffff -r 7 +872834730ffffff +``` + @@ -340,9 +461,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -351,13 +473,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Error compactCells(const H3Index *cellSet, H3Index *compactedSet, const int64_t numCells); ``` - - - -```py -h3.compact_cells(cells) -``` - @@ -381,6 +496,44 @@ function example() { } ``` + + + +```py +h3.compact_cells(cells) +``` + + + + +```sh +$ 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. The compacted cells will be printed one per line to stdout. +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. The compacted cells will be printed one per line to stdout. + -h, --help Show this help message. + -f, --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. +``` + +```bash +$ 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 +``` + @@ -395,9 +548,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -406,13 +560,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Error uncompactCells(const H3Index *compactedSet, const int64_t numCells, H3Index *cellSet, const int64_t maxCells, const int res); ``` - - - -```py -h3.uncompact_cells(cells, res) -``` - @@ -437,6 +584,51 @@ function example() { } ``` + + + +```py +h3.uncompact_cells(cells, res) +``` + + + + +```sh +$ h3 uncompactCells --help +h3: Unompacts the provided set of compacted cells.The uncompacted cells will be printed one per line to stdout. +H3 4.1.0 + + uncompactCells Unompacts the provided set of compacted cells.The uncompacted cells will be printed one per line to stdout. + -h, --help Show this help message. + -f, --file The file to load the cells from. Use -- to read from stdin. + -c, --cells The cells to uncompact. Up to 100 cells if provided as hexadecimals with zero padding. + -r, --resolution Required. Resolution, 0-15 inclusive, that the compacted set should be uncompacted to. Must be greater than or equal to the highest resolution within the compacted set. +``` + +```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 +``` + @@ -451,9 +643,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -463,7 +656,7 @@ H3Error uncompactCellsSize(const H3Index *compactedSet, const int64_t numCompact ``` - + :::note @@ -472,7 +665,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -481,7 +674,16 @@ This function exists for memory management and is not exposed. ::: - + + +:::note + +This function exists for memory management and is not exposed. + +::: + + + :::note diff --git a/website/docs/api/indexing.mdx b/website/docs/api/indexing.mdx index 494d3dfb5..fc27b8d68 100644 --- a/website/docs/api/indexing.mdx +++ b/website/docs/api/indexing.mdx @@ -17,9 +17,10 @@ These functions are used for finding the H3 cell index containing coordinates, a defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -28,13 +29,6 @@ These functions are used for finding the H3 cell index containing coordinates, a H3Error latLngToCell(const LatLng *g, int res, H3Index *out); ``` - - - -```py -h3.latlng_to_cell(lat, lng, resolution) -``` - @@ -59,6 +53,33 @@ function example() { } ``` + + + +```py +h3.latlng_to_cell(lat, lng, resolution) +``` + + + + +```sh +$ h3 latLngToCell --help +h3: Convert degrees latitude/longitude coordinate to an H3 cell +H3 4.1.0 + + latLngToCell Convert degrees latitude/longitude coordinate to an H3 cell + -h, --help Show this help message. + -r, --resolution Required. Resolution, 0-15 inclusive. + --lat, --latitude Required. Latitude in degrees. + --lng, --longitude Required. Longitude in degrees. +``` + +```bash +$ h3 latLngToCell --lat 45 --lng 40 -r 2 +822d57fffffffff +``` + @@ -74,9 +95,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -85,13 +107,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Error cellToLatLng(H3Index cell, LatLng *g); ``` - - - -```py -h3.cell_to_latlng(cell) -``` - @@ -114,6 +129,31 @@ function example() { } ``` + + + +```py +h3.cell_to_latlng(cell) +``` + + + + +```sh +$ h3 cellToLatLng --help +h3: Convert an H3Cell to a WKT POINT coordinate +H3 4.1.0 + + cellToLatLng Convert an H3Cell to a WKT POINT coordinate + -h, --help Show this help message. + -c, --cell Required. H3 Cell +``` + +```bash +$ h3 cellToLatLng -c 85283473fffffff +POINT(-121.9763759726 37.3457933754) +``` + @@ -135,9 +175,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -146,13 +187,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Error cellToBoundary(H3Index cell, CellBoundary *bndry); ``` - - - -```py -h3.cell_to_boundary(cell, geo_json=False) -``` - @@ -175,6 +209,31 @@ function example() { } ``` + + + +```py +h3.cell_to_boundary(cell, geo_json=False) +``` + + + + +```sh +$ h3 cellToBoundary --help +h3: Convert an H3 cell to a WKT POLYGON defining its boundary +H3 4.1.0 + + cellToBoundary Convert an H3 cell to a WKT POLYGON defining its boundary + -h, --help Show this help message. + -c, --cell Required. H3 Cell +``` + +```bash +$ h3 cellToBoundary -c 85283473fffffff +POLYGON((-121.9150803271 37.2713558667, -121.8622232890 37.3539264509, -121.9235499963 37.4283411861, -122.0377349643 37.4201286777, -122.0904289290 37.3375560844, -122.0291013092 37.2631979746, -121.9150803271 37.2713558667)) +``` + diff --git a/website/docs/api/inspection.mdx b/website/docs/api/inspection.mdx index db8f9d22a..24a156399 100644 --- a/website/docs/api/inspection.mdx +++ b/website/docs/api/inspection.mdx @@ -17,9 +17,10 @@ These functions provide metadata about an H3 index, such as its resolution or ba defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -28,13 +29,6 @@ These functions provide metadata about an H3 index, such as its resolution or ba int getResolution(H3Index h); ``` - - - -```py -h3.get_resolution(h) -``` - @@ -57,6 +51,31 @@ function example() { } ``` + + + +```py +h3.get_resolution(h) +``` + + + + +```sh +$ h3 getResolution --help +h3: Extracts the resolution (0 - 15) from the H3 cell +H3 4.1.0 + + getResolution Extracts the resolution (0 - 15) from the H3 cell + -h, --help Show this help message. + -c, --cell Required. H3 Cell +``` + +```bash +$ h3 getResolution -c 85283473fffffff +5 +``` + @@ -69,9 +88,10 @@ Returns the resolution of the index. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -80,13 +100,6 @@ Returns the resolution of the index. int getBaseCellNumber(H3Index h); ``` - - - -```py -h3.get_base_cell_number(h) -``` - @@ -109,6 +122,31 @@ function example() { } ``` + + + +```py +h3.get_base_cell_number(h) +``` + + + + +```sh +$ h3 getBaseCellNumber --help +h3: Extracts the base cell number (0 - 121) from the H3 cell +H3 4.1.0 + + getBaseCellNumber Extracts the base cell number (0 - 121) from the H3 cell + -h, --help Show this help message. + -c, --cell Required. H3 Cell +``` + +```bash +$ h3 getBaseCellNumber -c 85283473fffffff +20 +``` + @@ -121,9 +159,10 @@ Returns the base cell number of the index. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -132,13 +171,6 @@ Returns the base cell number of the index. H3Error stringToH3(const char *str, H3Index *out); ``` - - - -```py -h3.string_to_h3(h) -``` - @@ -151,6 +183,18 @@ long stringToH3(String h3Address); The H3 JavaScript binding supports only the string representation of an H3 index. + + + +```py +h3.string_to_h3(h) +``` + + + + +The H3 CLI supports only the string representation of an H3 index. + @@ -165,9 +209,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -177,23 +222,23 @@ H3Error h3ToString(H3Index h, char *str, size_t sz); ``` - + -```py -h3.h3_to_string(h) +```java +String h3ToString(long h3); ``` - + -```java -String h3ToString(long h3); +```py +h3.h3_to_string(h) ``` - + -The H3 JavaScript binding supports only the string representation of an H3 index. +The H3 CLI supports only the string representation of an H3 index. @@ -209,9 +254,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -220,13 +266,6 @@ Returns 0 (`E_SUCCESS`) on success. int isValidCell(H3Index h); ``` - - - -```py -h3.is_valid_cell(h) -``` - @@ -249,6 +288,31 @@ function example() { } ``` + + + +```py +h3.is_valid_cell(h) +``` + + + + +```sh +$ h3 isValidCell --help +h3: Checks if the provided H3 index is actually valid +H3 4.1.0 + + isValidCell Checks if the provided H3 index is actually valid + -h, --help Show this help message. + -c, --cell Required. H3 Cell +``` + +```bash +$ h3 isValidCell -c 85283473fffffff +true +``` + @@ -261,9 +325,10 @@ Returns non-zero if this is a valid H3 cell index. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -272,13 +337,6 @@ Returns non-zero if this is a valid H3 cell index. int isResClassIII(H3Index h); ``` - - - -```py -h3.is_res_class_III(h) -``` - @@ -301,6 +359,31 @@ function example() { } ``` + + + +```py +h3.is_res_class_III(h) +``` + + + + +```sh +$ h3 isResClassIII --help +h3: Checks if the provided H3 index has a Class III orientation +H3 4.1.0 + + isResClassIII Checks if the provided H3 index has a Class III orientation + -h, --help Show this help message. + -c, --cell Required. H3 Cell +``` + +```bash +$ h3 isResClassIII -c 85283473fffffff +true +``` + @@ -313,9 +396,10 @@ Returns non-zero if this index has a resolution with Class III orientation. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -324,13 +408,6 @@ Returns non-zero if this index has a resolution with Class III orientation. int isPentagon(H3Index h); ``` - - - -```py -h3.is_pentagon(h) -``` - @@ -353,6 +430,31 @@ function example() { } ``` + + + +```py +h3.is_pentagon(h) +``` + + + + +```sh +$ h3 isPentagon --help +h3: Checks if the provided H3 index is a pentagon instead of a hexagon +H3 4.1.0 + + isPentagon Checks if the provided H3 index is a pentagon instead of a hexagon + -h, --help Show this help message. + -c, --cell Required. H3 Cell +``` + +```bash +$ h3 isPentagon -c 85283473fffffff +false +``` + @@ -365,9 +467,10 @@ Returns non-zero if this index represents a pentagonal cell. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -376,13 +479,6 @@ Returns non-zero if this index represents a pentagonal cell. H3Error getIcosahedronFaces(H3Index h, int* out); ``` - - - -```py -h3.get_icosahedron_faces(h) -``` - @@ -405,6 +501,30 @@ function example() { } ``` + + + +```py +h3.get_icosahedron_faces(h) +``` + + + + +```sh +$ h3 getIcosahedronFaces --help +h3: Returns the icosahedron face numbers (0 - 19) that the H3 index intersects +H3 4.1.0 + + getIcosahedronFaces Returns the icosahedron face numbers (0 - 19) that the H3 index intersects + -h, --help Show this help message. + -c, --cell Required. H3 Cell +``` + +```bash +$ h3 getIcosahedronFaces -c 85283473fffffff +7 +``` @@ -421,9 +541,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -433,7 +554,7 @@ H3Error maxFaceCount(H3Index h3, int *out); ``` - + :::note @@ -442,7 +563,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -451,7 +572,16 @@ This function exists for memory management and is not exposed. ::: - + + +:::note + +This function exists for memory management and is not exposed. + +::: + + + :::note diff --git a/website/docs/api/misc.mdx b/website/docs/api/misc.mdx index ffeba3cc9..db02b0eae 100644 --- a/website/docs/api/misc.mdx +++ b/website/docs/api/misc.mdx @@ -17,9 +17,10 @@ These functions include descriptions of the H3 grid system. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -28,15 +29,6 @@ These functions include descriptions of the H3 grid system. double degsToRads(double degrees); ``` - - - -:::note - -Use `math.radians(degrees)` instead. - -::: - @@ -60,6 +52,33 @@ function example() { } ``` + + + +:::note + +Use `math.radians(degrees)` instead. + +::: + + + + +```sh +$ h3 degsToRads --help +h3: Converts degrees to radians +H3 4.1.0 + + degsToRads Converts degrees to radians + -d, --degree Required. Angle in degrees + -h, --help Show this help message. +``` + +```bash +$ h3 degsToRads -d 180 +3.1415926536 +``` + @@ -72,9 +91,10 @@ Converts degrees to radians. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -83,15 +103,6 @@ Converts degrees to radians. double radsToDegs(double radians); ``` - - - -:::note - -Use `math.degrees(radians)` instead. - -::: - @@ -115,6 +126,33 @@ function example() { } ``` + + + +:::note + +Use `math.degrees(radians)` instead. + +::: + + + + +```sh +$ h3 radsToDegs --help +h3: Converts radians to degrees +H3 4.1.0 + + radsToDegs Converts radians to degrees + -r, --radian Required. Angle in radians + -h, --help Show this help message. +``` + +```bash +$ h3 radsToDegs -r 1 +57.2957795131 +``` + @@ -127,9 +165,10 @@ Converts radians to degrees. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -138,13 +177,6 @@ Converts radians to degrees. H3Error getHexagonAreaAvgKm2(int res, double *out); ``` - - - -```py -h3.get_hexagon_area_avg(res, unit='km^2') -``` - @@ -166,6 +198,31 @@ function example() { } ``` + + + +```py +h3.get_hexagon_area_avg(res, unit='km^2') +``` + + + + +```sh +$ h3 getHexagonAreaAvgKm2 --help +h3: The average area in square kilometers for a hexagon of a given resolution (excludes pentagons) +H3 4.1.0 + + getHexagonAreaAvgKm2 The average area in square kilometers for a hexagon of a given resolution (excludes pentagons) + -r, --resolution Required. Resolution, 0-15 inclusive. + -h, --help Show this help message. +``` + +```bash +$ h3 getHexagonAreaAvgKm2 -r 1 +609788.4417941332 +``` + @@ -178,9 +235,10 @@ Average hexagon area in square kilometers at the given resolution. Excludes pent defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -189,13 +247,6 @@ Average hexagon area in square kilometers at the given resolution. Excludes pent H3Error getHexagonAreaAvgM2(int res, double *out); ``` - - - -```py -h3.get_hexagon_area_avg(res, unit='m^2') -``` - @@ -217,6 +268,31 @@ function example() { } ``` + + + +```py +h3.get_hexagon_area_avg(res, unit='m^2') +``` + + + + +```sh +$ h3 getHexagonAreaAvgM2 --help +h3: The average area in square meters for a hexagon of a given resolution (excludes pentagons) +H3 4.1.0 + + getHexagonAreaAvgM2 The average area in square meters for a hexagon of a given resolution (excludes pentagons) + -r, --resolution Required. Resolution, 0-15 inclusive. + -h, --help Show this help message. +``` + +```bash +$ h3 getHexagonAreaAvgM2 -r 5 +252903858.1819452047 +``` + @@ -231,9 +307,10 @@ Average hexagon area in square meters at the given resolution. Excludes pentagon defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -242,13 +319,6 @@ Average hexagon area in square meters at the given resolution. Excludes pentagon H3Error cellAreaRads2(H3Index h, double *out); ``` - - - -```py -h3.cell_area(h, unit='rads^2') -``` - @@ -271,6 +341,31 @@ function example() { } ``` + + + +```py +h3.cell_area(h, unit='rads^2') +``` + + + + +```sh +$ h3 cellAreaRads2 --help +h3: The exact area of a specific cell in square radians +H3 4.1.0 + + cellAreaRads2 The exact area of a specific cell in square radians + -c, --cell Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 cellAreaRads2 -c 85283473fffffff +0.0000065310 +``` + @@ -283,9 +378,10 @@ Exact area of specific cell in square radians. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -294,13 +390,6 @@ Exact area of specific cell in square radians. H3Error cellAreaKm2(H3Index h, double *out); ``` - - - -```py -h3.cell_area(h, unit='km^2') -``` - @@ -323,6 +412,31 @@ function example() { } ``` + + + +```py +h3.cell_area(h, unit='km^2') +``` + + + + +```sh +$ h3 cellAreaKm2 --help +h3: The exact area of a specific cell in square kilometers +H3 4.1.0 + + cellAreaKm2 The exact area of a specific cell in square kilometers + -c, --cell Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 cellAreaKm2 -c 85283473fffffff +265.0925581283 +``` + @@ -335,9 +449,10 @@ Exact area of specific cell in square kilometers. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -346,13 +461,6 @@ Exact area of specific cell in square kilometers. H3Error cellAreaM2(H3Index h, double *out); ``` - - - -```py -h3.cell_area(h, unit='m^2') -``` - @@ -375,6 +483,31 @@ function example() { } ``` + + + +```py +h3.cell_area(h, unit='m^2') +``` + + + + +```sh +$ h3 cellAreaM2 --help +h3: The exact area of a specific cell in square meters +H3 4.1.0 + + cellAreaM2 The exact area of a specific cell in square meters + -c, --cell Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 cellAreaM2 -c 85283473fffffff +265092558.1282823086 +``` + @@ -387,9 +520,10 @@ Exact area of specific cell in square meters. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -398,13 +532,6 @@ Exact area of specific cell in square meters. H3Error getHexagonEdgeLengthAvgKm(int res, double *out); ``` - - - -```py -h3.get_hexagon_edge_length_avg(res, unit='km') -``` - @@ -426,6 +553,31 @@ function example() { } ``` + + + +```py +h3.get_hexagon_edge_length_avg(res, unit='km') +``` + + + + +```sh +$ h3 getHexagonEdgeLengthAvgKm --help +h3: The average hexagon edge length in kilometers of a given resolution (excludes pentagons) +H3 4.1.0 + + getHexagonEdgeLengthAvgKm The average hexagon edge length in kilometers of a given resolution (excludes pentagons) + -r, --resolution Required. Resolution, 0-15 inclusive. + -h, --help Show this help message. +``` + +```bash +$ h3 getHexagonEdgeLengthAvgKm -r 5 +9.8540909900 +``` + @@ -438,9 +590,10 @@ Average hexagon edge length in kilometers at the given resolution. Excludes pent defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -449,13 +602,6 @@ Average hexagon edge length in kilometers at the given resolution. Excludes pent H3Error getHexagonEdgeLengthAvgM(int res, double *out); ``` - - - -```py -h3.get_hexagon_edge_length_avg(res, unit='m') -``` - @@ -477,6 +623,31 @@ function example() { } ``` + + + +```py +h3.get_hexagon_edge_length_avg(res, unit='m') +``` + + + + +```sh +$ h3 getHexagonEdgeLengthAvgM --help +h3: The average hexagon edge length in meters of a given resolution (excludes pentagons) +H3 4.1.0 + + getHexagonEdgeLengthAvgM The average hexagon edge length in meters of a given resolution (excludes pentagons) + -r, --resolution Required. Resolution, 0-15 inclusive. + -h, --help Show this help message. +``` + +```bash +$ h3 getHexagonEdgeLengthAvgM -r 5 +9854.0909900000 +``` + @@ -490,9 +661,10 @@ Average hexagon edge length in meters at the given resolution. Excludes pentagon defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -501,13 +673,6 @@ Average hexagon edge length in meters at the given resolution. Excludes pentagon H3Error edgeLengthKm(H3Index edge, double *length); ``` - - - -```py -h3.exact_edge_length(h, unit='km') -``` - @@ -530,6 +695,31 @@ function example() { } ``` + + + +```py +h3.exact_edge_length(h, unit='km') +``` + + + + +```sh +$ h3 edgeLengthKm --help +h3: The exact edge length of a specific directed edge in kilometers +H3 4.1.0 + + edgeLengthKm The exact edge length of a specific directed edge in kilometers + -c, --cell Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 edgeLengthKm -c 115283473fffffff +10.2947360862 +``` + @@ -542,9 +732,10 @@ Exact edge length of specific unidirectional edge in kilometers. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -553,13 +744,6 @@ Exact edge length of specific unidirectional edge in kilometers. H3Error edgeLengthM(H3Index edge, double *length); ``` - - - -```py -h3.exact_edge_length(h, unit='m') -``` - @@ -582,6 +766,31 @@ function example() { } ``` + + + +```py +h3.exact_edge_length(h, unit='m') +``` + + + + +```sh +$ h3 edgeLengthM --help +h3: The exact edge length of a specific directed edge in meters +H3 4.1.0 + + edgeLengthM The exact edge length of a specific directed edge in meters + -c, --cell Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 edgeLengthM -c 115283473fffffff +10294.7360861995 +``` + @@ -594,9 +803,10 @@ Exact edge length of specific unidirectional edge in meters. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -605,13 +815,6 @@ Exact edge length of specific unidirectional edge in meters. H3Error edgeLengthRads(H3Index edge, double *length); ``` - - - -```py -h3.exact_edge_length(h, unit='rads') -``` - @@ -634,6 +837,31 @@ function example() { } ``` + + + +```py +h3.exact_edge_length(h, unit='rads') +``` + + + + +```sh +$ h3 edgeLengthRads --help +h3: The exact edge length of a specific directed edge in radians +H3 4.1.0 + + edgeLengthRads The exact edge length of a specific directed edge in radians + -c, --cell Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 edgeLengthRads -c 115283473fffffff +0.0016158726 +``` + @@ -646,9 +874,10 @@ Exact edge length of specific unidirectional edge in radians. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -657,13 +886,6 @@ Exact edge length of specific unidirectional edge in radians. H3Error getNumCells(int res, int64_t *out); ``` - - - -```py -h3.get_num_cells(res) -``` - @@ -685,6 +907,31 @@ function example() { } ``` + + + +```py +h3.get_num_cells(res) +``` + + + + +```sh +$ h3 getNumCells --help +h3: The number of unique H3 cells for a specified resolution +H3 4.1.0 + + getNumCells The number of unique H3 cells for a specified resolution + -r, --resolution Required. Resolution, 0-15 inclusive. + -h, --help Show this help message. +``` + +```bash +$ h3 getNumCells -r 5 +2016842 +``` + @@ -697,9 +944,10 @@ Number of unique H3 indexes at the given resolution. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -708,13 +956,6 @@ Number of unique H3 indexes at the given resolution. H3Error getRes0Cells(H3Index *out); ``` - - - -```py -h3.get_res0_cells() -``` - @@ -736,6 +977,29 @@ function example() { } ``` + + + +```py +h3.get_res0_cells() +``` + + + + +```sh +$ h3 getRes0Cells --help +h3: Returns all of the resolution 0 cells +H3 4.1.0 + + getRes0Cells Returns all of the resolution 0 cells + -h, --help Show this help message. +``` + +```bash +$ h3 getRes0Cells +[8001fffffffffff, 8003fffffffffff, 8005fffffffffff, 8007fffffffffff, 8009fffffffffff, 800bfffffffffff, 800dfffffffffff, 800ffffffffffff, 8011fffffffffff, 8013fffffffffff, 8015fffffffffff, 8017fffffffffff, 8019fffffffffff, 801bfffffffffff, 801dfffffffffff, 801ffffffffffff, 8021fffffffffff, 8023fffffffffff, 8025fffffffffff, 8027fffffffffff, 8029fffffffffff, 802bfffffffffff, 802dfffffffffff, 802ffffffffffff, 8031fffffffffff, 8033fffffffffff, 8035fffffffffff, 8037fffffffffff, 8039fffffffffff, 803bfffffffffff, 803dfffffffffff, 803ffffffffffff, 8041fffffffffff, 8043fffffffffff, 8045fffffffffff, 8047fffffffffff, 8049fffffffffff, 804bfffffffffff, 804dfffffffffff, 804ffffffffffff, 8051fffffffffff, 8053fffffffffff, 8055fffffffffff, 8057fffffffffff, 8059fffffffffff, 805bfffffffffff, 805dfffffffffff, 805ffffffffffff, 8061fffffffffff, 8063fffffffffff, 8065fffffffffff, 8067fffffffffff, 8069fffffffffff, 806bfffffffffff, 806dfffffffffff, 806ffffffffffff, 8071fffffffffff, 8073fffffffffff, 8075fffffffffff, 8077fffffffffff, 8079fffffffffff, 807bfffffffffff, 807dfffffffffff, 807ffffffffffff, 8081fffffffffff, 8083fffffffffff, 8085fffffffffff, 8087fffffffffff, 8089fffffffffff, 808bfffffffffff, 808dfffffffffff, 808ffffffffffff, 8091fffffffffff, 8093fffffffffff, 8095fffffffffff, 8097fffffffffff, 8099fffffffffff, 809bfffffffffff, 809dfffffffffff, 809ffffffffffff, 80a1fffffffffff, 80a3fffffffffff, 80a5fffffffffff, 80a7fffffffffff, 80a9fffffffffff, 80abfffffffffff, 80adfffffffffff, 80affffffffffff, 80b1fffffffffff, 80b3fffffffffff, 80b5fffffffffff, 80b7fffffffffff, 80b9fffffffffff, 80bbfffffffffff, 80bdfffffffffff, 80bffffffffffff, 80c1fffffffffff, 80c3fffffffffff, 80c5fffffffffff, 80c7fffffffffff, 80c9fffffffffff, 80cbfffffffffff, 80cdfffffffffff, 80cffffffffffff, 80d1fffffffffff, 80d3fffffffffff, 80d5fffffffffff, 80d7fffffffffff, 80d9fffffffffff, 80dbfffffffffff, 80ddfffffffffff, 80dffffffffffff, 80e1fffffffffff, 80e3fffffffffff, 80e5fffffffffff, 80e7fffffffffff, 80e9fffffffffff, 80ebfffffffffff, 80edfffffffffff, 80effffffffffff, 80f1fffffffffff, 80f3fffffffffff] +``` @@ -751,9 +1015,10 @@ parents of all other cell indexes in the H3 grid system. The returned indexes co defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -763,7 +1028,7 @@ int res0CellCount(void); ``` - + :::note @@ -772,7 +1037,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -781,7 +1046,16 @@ This function exists for memory management and is not exposed. ::: - + + +:::note + +This function exists for memory management and is not exposed. + +::: + + + :::note @@ -801,9 +1075,10 @@ Number of resolution `0` H3 indexes, which is defined as 122. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -812,13 +1087,6 @@ Number of resolution `0` H3 indexes, which is defined as 122. H3Error getPentagons(int res, H3Index *out); ``` - - - -```py -h3.get_pentagons(res) -``` - @@ -841,6 +1109,31 @@ function example() { } ``` + + + +```py +h3.get_pentagons(res) +``` + + + + +```sh +$ 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. +``` + +```bash +$ h3 getPentagons -r 5 +[85080003fffffff, 851c0003fffffff, 85300003fffffff, 854c0003fffffff, 85620003fffffff, 85740003fffffff, 857e0003fffffff, 85900003fffffff, 85a60003fffffff, 85c20003fffffff, 85d60003fffffff, 85ea0003fffffff] +``` + @@ -856,9 +1149,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -868,7 +1162,7 @@ int pentagonCount(void); ``` - + :::note @@ -877,7 +1171,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -886,7 +1180,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -894,6 +1188,23 @@ This function exists for memory management and is not exposed. ::: + + + +```sh +$ h3 pentagonCount --help +h3: Returns 12 +H3 4.1.0 + + pentagonCount Returns 12 + -h, --help Show this help message. +``` + +```bash +$ h3 pentagonCount +12 +``` + @@ -906,9 +1217,10 @@ Number of pentagon H3 indexes per resolution. This is always 12, but provided as defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -917,13 +1229,6 @@ Number of pentagon H3 indexes per resolution. This is always 12, but provided as double greatCircleDistanceKm(const LatLng *a, const LatLng *b); ``` - - - -```py -h3.great_circle_distance(point1, point2, unit='km') -``` - @@ -946,6 +1251,32 @@ function example() { } ``` + + + +```py +h3.great_circle_distance(point1, point2, unit='km') +``` + + + + +```sh +$ h3 greatCircleDistanceKm --help +h3: Calculates the 'great circle' or 'haversine' distance between two lat, lng points, in kilometers +H3 4.1.0 + + greatCircleDistanceKm Calculates the 'great circle' or 'haversine' distance between two lat, lng points, in kilometers + -f, --file The file to load the coordinates from. Use -- to read from stdin. + -c, --coordinates The array of coordinates to convert. Up to 1500 characters. + -h, --help Show this help message. +``` + +```bash +$ h3 greatCircleDistanceKm -c "[[-10, 0], [10, 0]]" +2223.9010395046 +``` + @@ -959,9 +1290,10 @@ LatLng points (lat/lng pairs) in kilometers. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -970,13 +1302,6 @@ LatLng points (lat/lng pairs) in kilometers. double greatCircleDistanceM(const LatLng *a, const LatLng *b); ``` - - - -```py -h3.latlng_distance(point1, point2, unit='m') -``` - @@ -999,6 +1324,32 @@ function example() { } ``` + + + +```py +h3.latlng_distance(point1, point2, unit='m') +``` + + + + +```sh +$ h3 greatCircleDistanceM --help +h3: Calculates the 'great circle' or 'haversine' distance between two lat, lng points, in meters +H3 4.1.0 + + greatCircleDistanceM Calculates the 'great circle' or 'haversine' distance between two lat, lng points, in meters + -f, --file The file to load the coordinates from. Use -- to read from stdin. + -c, --coordinates The array of coordinates to convert. Up to 1500 characters. + -h, --help Show this help message. +``` + +```bash +$ h3 greatCircleDistanceM -c "[[-10, 0], [10, 0]]" +2223901.0395045886 +``` + @@ -1012,9 +1363,10 @@ LatLng points (lat/lng pairs) in meters. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -1023,13 +1375,6 @@ LatLng points (lat/lng pairs) in meters. double greatCircleDistanceRads(const LatLng *a, const LatLng *b); ``` - - - -```py -h3.latlng_distance(point1, point2, unit='rads') -``` - @@ -1052,6 +1397,32 @@ function example() { } ``` + + + +```py +h3.latlng_distance(point1, point2, unit='rads') +``` + + + + +```sh +$ h3 greatCircleDistanceRads --help +h3: Calculates the 'great circle' or 'haversine' distance between two lat, lng points, in radians +H3 4.1.0 + + greatCircleDistanceRadsCalculates the 'great circle' or 'haversine' distance between two lat, lng points, in radians + -f, --file The file to load the coordinates from. Use -- to read from stdin. + -c, --coordinates The array of coordinates to convert. Up to 1500 characters. + -h, --help Show this help message. +``` + +```bash +$ h3 greatCircleDistanceRads -c "[[-10, 0], [10, 0]]" +0.3490658504 +``` + @@ -1066,6 +1437,7 @@ LatLng points (lat/lng pairs) in radians. values={[ {label: 'C', value: 'c'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -1095,6 +1467,24 @@ function example() { } ``` + + + +```sh +$ h3 describeH3Error --help +h3: Returns a description of the provided H3 error code number, or indicates the number is itself invalid. +H3 4.1.0 + + describeH3ErrorReturns a description of the provided H3 error code number, or indicates the number is itself invalid. + -e, --error Required. H3 Error code to describe + -h, --help Show this help message. +``` + +```bash +$ h3 describeH3Error -e 5 +Cell argument was not valid +``` + diff --git a/website/docs/api/regions.mdx b/website/docs/api/regions.mdx index 0de8f3c39..4d9336e08 100644 --- a/website/docs/api/regions.mdx +++ b/website/docs/api/regions.mdx @@ -17,9 +17,10 @@ These functions convert H3 indexes to and from polygonal areas. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -28,13 +29,6 @@ These functions convert H3 indexes to and from polygonal areas. H3Error polygonToCells(const GeoPolygon *geoPolygon, int res, uint32_t flags, H3Index *out); ``` - - - -```py -h3.polygon_to_cells(polygons, res, geo_json_conformant=False) -``` - @@ -62,6 +56,39 @@ function example() { } ``` + + + +```py +h3.polygon_to_cells(polygons, res, geo_json_conformant=False) +``` + + + + +```sh +$ h3 polygonToCells --help +h3: Converts a polygon (array of lat, lng points, or array of arrays of lat, lng points) into a set of covering cells at the specified resolution +H3 4.1.0 + + polygonToCells Converts a polygon (array of lat, lng points, or array of arrays of lat, lng points) into a set of covering cells at the specified resolution + -h, --help Show this help message. + -f, --file The file to load the polygon from. Use -- to read from stdin. + -p, --polygon The polygon to convert. Up to 1500 characters. + -r, --resolution Required. Resolution, 0-15 inclusive, that the polygon should be converted to. +``` + +```bash +$ h3 polygonToCells -r 7 -p "[[37.813318999983238, -122.4089866999972145], [37.7198061999978478, -122.3544736999993603], [37.8151571999998453, -122.4798767000009008]]" +87283082bffffff +872830870ffffff +872830820ffffff +87283082effffff +872830828ffffff +87283082affffff +872830876ffffff +``` + @@ -83,9 +110,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -95,7 +123,7 @@ H3Error maxPolygonToCellsSize(const GeoPolygon *geoPolygon, int res, uint32_t fl ``` - + :::note @@ -104,7 +132,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -113,7 +141,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -121,6 +149,26 @@ This function exists for memory management and is not exposed. ::: + + + +```sh +$ h3 maxPolygonToCellsSize --help +h3: Returns the maximum number of cells that could be needed to cover the polygon. Will always be equal or more than actually necessary +H3 4.1.0 + + maxPolygonToCellsSize Returns the maximum number of cells that could be needed to cover the polygon. Will always be equal or more than actually necessary + -h, --help Show this help message. + -f, --file The file to load the polygon from. Use -- to read from stdin. + -p, --polygon The polygon to convert. Up to 1500 characters. + -r, --resolution Required. Resolution, 0-15 inclusive, that the polygon should be converted to. +``` + +```bash +$ h3 maxPolygonToCellsSize -r 7 -p "[[37.813318999983238, -122.4089866999972145], [37.7198061999978478, -122.3544736999993603], [37.8151571999998453, -122.4798767000009008]]" +100 +``` + @@ -136,9 +184,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -147,13 +196,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Error cellsToLinkedMultiPolygon(const H3Index *h3Set, const int numHexes, LinkedGeoPolygon *out); ``` - - - -```py -h3.cells_to_multi_polygon(hexes, geo_json=False) -``` - @@ -176,6 +218,32 @@ function example() { } ``` + + + +```py +h3.cells_to_multi_polygon(hexes, geo_json=False) +``` + + + + +```sh +$ h3 cellsToMultiPolygon --help +h3: Returns a polygon (array of arrays of lat, lng points) for a set of cells +H3 4.1.0 + + cellsToMultiPolygon Returns a polygon (array of arrays of lat, lng points) for a set of cells + -h, --help Show this help message. + -f, --file The file to load the cells from. Use -- to read from stdin. + -c, --cells The cells to convert. Up to 100 cells if provided as hexadecimals with zero padding. +``` + +```bash +$ h3 cellsToMultiPolygon -c 872830828ffffff,87283082effffff +[[[[37.784046, -122.427089], [37.772267, -122.434586], [37.761736, -122.425769], [37.762982, -122.409455], [37.752446, -122.400640], [37.753689, -122.384324], [37.765468, -122.376819], [37.776004, -122.385635], [37.774761, -122.401954], [37.785293, -122.410771]]]] +``` + @@ -201,9 +269,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -213,7 +282,7 @@ void destroyLinkedMultiPolygon(LinkedGeoPolygon *polygon); ``` - + :::note @@ -222,7 +291,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -231,7 +300,16 @@ This function exists for memory management and is not exposed. ::: - + + +:::note + +This function exists for memory management and is not exposed. + +::: + + + :::note diff --git a/website/docs/api/traversal.mdx b/website/docs/api/traversal.mdx index 5b6738fef..2dd0789e1 100644 --- a/website/docs/api/traversal.mdx +++ b/website/docs/api/traversal.mdx @@ -17,9 +17,10 @@ Grid traversal allows finding cells in the vicinity of an origin cell, and deter defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -28,13 +29,6 @@ Grid traversal allows finding cells in the vicinity of an origin cell, and deter H3Error gridDisk(H3Index origin, int k, H3Index* out); ``` - - - -```py -h3.grid_disk(origin, k) -``` - @@ -58,6 +52,32 @@ function example() { } ``` + + + +```py +h3.grid_disk(origin, k) +``` + + + + +```sh +$ h3 gridDisk --help +h3: Returns a JSON array of a H3 cells within 'k' steps of the origin cell +H3 4.1.0 + + gridDisk Returns a JSON array of a H3 cells within 'k' steps of the origin cell + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -k Required. Maximum grid distance for the output set +``` + +```bash +$ h3 gridDisk -k 5 -c 85283473fffffff +[ "85283473fffffff", "85283447fffffff", "8528347bfffffff", "85283463fffffff", "85283477fffffff", "8528340ffffffff", "8528340bfffffff", "85283457fffffff", "85283443fffffff", "8528344ffffffff", "852836b7fffffff", "8528346bfffffff", "8528346ffffffff", "85283467fffffff", "8528342bfffffff", "8528343bfffffff", "85283407fffffff", "85283403fffffff", "8528341bfffffff", "852834cffffffff", "85283453fffffff", "8528345bfffffff", "8528344bfffffff", "852836b3fffffff", "852836a3fffffff", "852836a7fffffff", "852830d3fffffff", "852830d7fffffff", "8528309bfffffff", "85283093fffffff", "8528342ffffffff", "85283423fffffff", "85283433fffffff", "852834abfffffff", "85283417fffffff", "85283413fffffff", "852834c7fffffff", "852834c3fffffff", "852834cbfffffff", "8529a927fffffff", "8529a92ffffffff", "85283697fffffff", "85283687fffffff", "852836bbfffffff", "852836abfffffff", "852836affffffff", "852830dbfffffff", "852830c3fffffff", "852830c7fffffff", "8528308bfffffff", "85283083fffffff", "85283097fffffff", "8528355bfffffff", "85283427fffffff", "85283437fffffff", "852834affffffff", "852834a3fffffff", "852834bbfffffff", "8528348ffffffff", "8528348bfffffff", "852834d7fffffff", "852834d3fffffff", "852834dbfffffff", "8529a937fffffff", "8529a923fffffff", "8529a92bfffffff", "85283693fffffff", "85283683fffffff", "8528368ffffffff", "85283617fffffff", "85283607fffffff", "85283633fffffff", "85283637fffffff", "852830cbfffffff", "852830cffffffff", "8528301bfffffff", "85283013fffffff", "8528308ffffffff", "85283087fffffff", "8528354bfffffff", "85283543fffffff", "85283553fffffff", "852835cbfffffff", "852835dbfffffff", "852834a7fffffff", "852834b7fffffff", "852834b3fffffff", "85283487fffffff", "85283483fffffff", "8528349bfffffff", "85291a6ffffffff" ] +``` + @@ -77,9 +97,10 @@ the output array may be left as zero, which can happen when crossing a pentagon. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -89,7 +110,7 @@ H3Error maxGridDiskSize(int k, int64_t *out); ``` - + :::note @@ -98,7 +119,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -107,7 +128,16 @@ This function exists for memory management and is not exposed. ::: - + + +:::note + +This function exists for memory management and is not exposed. + +::: + + + :::note @@ -127,9 +157,10 @@ Maximum number of indices that result from the `gridDisk` algorithm with the giv defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -138,13 +169,6 @@ Maximum number of indices that result from the `gridDisk` algorithm with the giv H3Error gridDiskDistances(H3Index origin, int k, H3Index* out, int* distances); ``` - - - -```py -h3.grid_disk_distances(origin, k) -``` - @@ -168,6 +192,33 @@ function example() { } ``` + + + +```py +h3.grid_disk_distances(origin, k) +``` + + + + +```sh +$ h3 gridDiskDistances --help +h3: Returns a JSON array of arrays of H3 cells, each array containing cells 'k' steps away from the origin cell, based on the outer array index +H3 4.1.0 + + gridDiskDistances Returns a JSON array of arrays of H3 cells, each array containing cells 'k' steps away from the origin cell, based on the outer array index + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -k Required. Maximum grid distance for the output set + -p, --pretty-print Determine if the JSON output should be pretty printed or not +``` + +```bash +$ h3 gridDiskDistances -k 5 -c 85283473fffffff +[["85283473fffffff"],["85283447fffffff","8528347bfffffff","85283463fffffff","85283477fffffff","8528340ffffffff","8528340bfffffff"],["85283457fffffff","85283443fffffff","8528344ffffffff","852836b7fffffff","8528346bfffffff","8528346ffffffff","85283467fffffff","8528342bfffffff","8528343bfffffff","85283407fffffff","85283403fffffff","8528341bfffffff"],["852834cffffffff","85283453fffffff","8528345bfffffff","8528344bfffffff","852836b3fffffff","852836a3fffffff","852836a7fffffff","852830d3fffffff","852830d7fffffff","8528309bfffffff","85283093fffffff","8528342ffffffff","85283423fffffff","85283433fffffff","852834abfffffff","85283417fffffff","85283413fffffff","852834c7fffffff"],["852834c3fffffff","852834cbfffffff","8529a927fffffff","8529a92ffffffff","85283697fffffff","85283687fffffff","852836bbfffffff","852836abfffffff","852836affffffff","852830dbfffffff","852830c3fffffff","852830c7fffffff","8528308bfffffff","85283083fffffff","85283097fffffff","8528355bfffffff","85283427fffffff","85283437fffffff","852834affffffff","852834a3fffffff","852834bbfffffff","8528348ffffffff","8528348bfffffff","852834d7fffffff"],["852834d3fffffff","852834dbfffffff","8529a937fffffff","8529a923fffffff","8529a92bfffffff","85283693fffffff","85283683fffffff","8528368ffffffff","85283617fffffff","85283607fffffff","85283633fffffff","85283637fffffff","852830cbfffffff","852830cffffffff","8528301bfffffff","85283013fffffff","8528308ffffffff","85283087fffffff","8528354bfffffff","85283543fffffff","85283553fffffff","852835cbfffffff","852835dbfffffff","852834a7fffffff","852834b7fffffff","852834b3fffffff","85283487fffffff","85283483fffffff","8528349bfffffff","85291a6ffffffff"]] +``` + @@ -186,9 +237,10 @@ the output array may be left as zero, which can happen when crossing a pentagon. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -197,13 +249,6 @@ the output array may be left as zero, which can happen when crossing a pentagon. H3Error gridDiskUnsafe(H3Index origin, int k, H3Index* out); ``` - - - -```py -h3.grid_disk_unsafe(h, k) -``` - @@ -221,6 +266,22 @@ This function is not exposed. ::: + + + +```py +h3.grid_disk_unsafe(h, k) +``` + + + + +:::note + +This function is not exposed. + +::: + @@ -244,9 +305,10 @@ Returns 0 (`E_SUCCESS`) if no pentagonal distortion is encountered. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -255,13 +317,6 @@ Returns 0 (`E_SUCCESS`) if no pentagonal distortion is encountered. H3Error gridDiskDistancesUnsafe(H3Index origin, int k, H3Index* out, int* distances); ``` - - - -```py -h3.grid_disk_distances_unsafe(h, k) -``` - @@ -280,6 +335,22 @@ This function is not exposed. ::: + + + +```py +h3.grid_disk_distances_unsafe(h, k) +``` + + + + +:::note + +This function is not exposed. + +::: + @@ -303,9 +374,10 @@ Returns 0 (`E_SUCCESS`) if no pentagonal distortion is encountered. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -314,13 +386,6 @@ Returns 0 (`E_SUCCESS`) if no pentagonal distortion is encountered. H3Error gridDiskDistancesSafe(H3Index origin, int k, H3Index* out, int* distances); ``` - - - -```py -h3.grid_disk_distances_safe(h, k) -``` - @@ -339,6 +404,22 @@ This function is not exposed. ::: + + + +```py +h3.grid_disk_distances_safe(h, k) +``` + + + + +:::note + +This function is not exposed. + +::: + @@ -360,9 +441,10 @@ Returns 0 (`E_SUCCESS`) on success. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -371,13 +453,6 @@ Returns 0 (`E_SUCCESS`) on success. H3Error gridDisksUnsafe(H3Index* h3Set, int length, int k, H3Index* out); ``` - - - -```py -h3.grid_disks_unsafe(h, k) -``` - @@ -396,6 +471,22 @@ This function is not exposed. ::: + + + +```py +h3.grid_disks_unsafe(h, k) +``` + + + + +:::note + +This function is not exposed. + +::: + @@ -413,9 +504,10 @@ is undefined defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -424,13 +516,6 @@ is undefined H3Error gridRingUnsafe(H3Index origin, int k, H3Index* out); ``` - - - -```py -h3.grid_ring_unsafe(h, k) -``` - @@ -454,6 +539,38 @@ function example() { } ``` + + + +```py +h3.grid_ring_unsafe(h, k) +``` + + + + +:::note + +The shell uses `gridRingUnsafe` internally to generate the results, but on failure falls back to `gridDiskDistances` and returns the set of cells at the specified distance to produce an equivalent to the "safe" version, but this consumes a lot of memory to do so. + +::: + +```sh +$ h3 gridRing --help +h3: Returns a JSON array of H3 cells, each cell 'k' steps away from the origin cell +H3 4.1.0 + + gridRing Returns a JSON array of H3 cells, each cell 'k' steps away from the origin cell + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -k Required. Maximum grid distance for the output set +``` + +```bash +$ h3 gridRing -k 1 -c 85283473fffffff +[ "8528340bfffffff", "85283447fffffff", "8528347bfffffff", "85283463fffffff", "85283477fffffff", "8528340ffffffff" ] +``` + @@ -468,9 +585,10 @@ Returns 0 (`E_SUCCESS`) if no pentagonal distortion was encountered. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -479,13 +597,6 @@ Returns 0 (`E_SUCCESS`) if no pentagonal distortion was encountered. H3Error gridPathCells(H3Index start, H3Index end, H3Index* out); ``` - - - -```py -h3.grid_path_cells(start, end) -``` - @@ -509,6 +620,32 @@ function example() { } ``` + + + +```py +h3.grid_path_cells(start, end) +``` + + + + +```sh +$ h3 gridPathCells --help +h3: Returns a JSON array of H3 cells from the origin cell to the destination cell (inclusive) +H3 4.1.0 + + gridPathCells Returns a JSON array of H3 cells from the origin cell to the destination cell (inclusive) + -h, --help Show this help message. + -o, --origin Required. The origin H3 cell + -d, --destination Required. The destination H3 cell +``` + +```bash +$ h3 gridPathCells -o 85283473fffffff -d 8528342bfffffff +[ "85283473fffffff", "85283477fffffff", "8528342bfffffff" ] +``` + @@ -535,9 +672,10 @@ distances for indexes on opposite sides of a pentagon. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -547,7 +685,7 @@ H3Error gridPathCellsSize(H3Index start, H3Index end, int64_t* size); ``` - + :::note @@ -556,7 +694,7 @@ This function exists for memory management and is not exposed. ::: - + :::note @@ -565,7 +703,16 @@ This function exists for memory management and is not exposed. ::: - + + +:::note + +This function exists for memory management and is not exposed. + +::: + + + :::note @@ -588,9 +735,10 @@ Returns 0 (`E_SUCCESS`) on success, or an error if the line cannot be computed. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -599,13 +747,6 @@ Returns 0 (`E_SUCCESS`) on success, or an error if the line cannot be computed. H3Error gridDistance(H3Index origin, H3Index h3, int64_t *distance); ``` - - - -```py -h3.grid_distance(h1, h2) -``` - @@ -629,6 +770,32 @@ function example() { } ``` + + + +```py +h3.grid_distance(h1, h2) +``` + + + + +```sh +$ h3 gridDistance --help +h3: Returns the number of steps along the grid to move from the origin cell to the destination cell +H3 4.1.0 + + gridDistance Returns the number of steps along the grid to move from the origin cell to the destination cell + -h, --help Show this help message. + -o, --origin Required. The origin H3 cell + -d, --destination Required. The destination H3 cell +``` + +```bash +$ h3 gridDistance -o 85283473fffffff -d 8528342bfffffff +2 +``` + @@ -646,9 +813,10 @@ space functions. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -657,13 +825,6 @@ space functions. H3Error cellToLocalIj(H3Index origin, H3Index h3, uint32_t mode, CoordIJ *out); ``` - - - -```py -h3.cell_to_local_ij(origin, h) -``` - @@ -688,6 +849,32 @@ function example() { } ``` + + + +```py +h3.cell_to_local_ij(origin, h) +``` + + + + +```sh +$ h3 cellToLocalIj --help +h3: Returns the IJ coordinate for a cell anchored to an origin cell +H3 4.1.0 + + cellToLocalIj Returns the IJ coordinate for a cell anchored to an origin cell + -h, --help Show this help message. + -c, --cell Required. H3 Cell + -o, --origin Required. The origin H3 cell +``` + +```bash +$ h3 cellToLocalIj -o 85283473fffffff -c 8528342bfffffff +[25, 13] +``` + @@ -705,9 +892,10 @@ versions of H3. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -716,13 +904,6 @@ versions of H3. H3Error localIjToCell(H3Index origin, const CoordIJ *ij, uint32_t mode, H3Index *out); ``` - - - -```py -h3.local_ij_to_cell(origin, i, j) -``` - @@ -746,6 +927,33 @@ function example() { } ``` + + + +```py +h3.local_ij_to_cell(origin, i, j) +``` + + + + +```sh +$ 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 +``` + +```bash +$ h3 localIjToCell -o 85283473fffffff -i 0 -j 0 +85280003fffffff +``` + diff --git a/website/docs/api/vertex.mdx b/website/docs/api/vertex.mdx index 1a367dd29..6abb0cce8 100644 --- a/website/docs/api/vertex.mdx +++ b/website/docs/api/vertex.mdx @@ -17,9 +17,10 @@ Vertex mode allows encoding the topological vertexes of H3 cells. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -28,13 +29,6 @@ Vertex mode allows encoding the topological vertexes of H3 cells. H3Error cellToVertex(H3Index origin, int vertexNum, H3Index *out); ``` - - - -```py -h3.cell_to_vertex(origin, vertex_num) -``` - @@ -58,6 +52,32 @@ function example() { } ``` + + + +```py +h3.cell_to_vertex(origin, vertex_num) +``` + + + + +```sh +$ 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 Required. H3 Cell + -v, --vertex Required. Vertex index number. 0-5 for hexagons, 0-4 for pentagons + -h, --help Show this help message. +``` + +```bash +$ h3 cellToVertex -v 2 -c 85283473fffffff +205283463fffffff +``` + @@ -71,9 +91,10 @@ for hexagonal cells, and 0 and 4 (inclusive) for pentagonal cells. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -82,13 +103,6 @@ for hexagonal cells, and 0 and 4 (inclusive) for pentagonal cells. H3Error cellToVertexes(H3Index origin, H3Index *out); ``` - - - -```py -h3.cell_to_vertexes(origin) -``` - @@ -111,6 +125,31 @@ function example() { } ``` + + + +```py +h3.cell_to_vertexes(origin) +``` + + + + +```sh +$ 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 Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 cellToVertexes -c 85283473fffffff +[22528340bfffffff, 235283447fffffff, 205283463fffffff, 255283463fffffff, 22528340ffffffff, 23528340bfffffff] +``` + @@ -126,9 +165,10 @@ array will be set to `0`. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -137,13 +177,6 @@ array will be set to `0`. H3Error vertexToLatLng(H3Index vertex, LatLng *point); ``` - - - -```py -h3.vertex_to_latlng(vertex) -``` - @@ -166,6 +199,31 @@ function example() { } ``` + + + +```py +h3.vertex_to_latlng(vertex) +``` + + + + +```sh +$ 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 Required. H3 Cell + -h, --help Show this help message. +``` + +```bash +$ h3 vertexToLatLng -c 255283463fffffff +POINT(-122.0377349643 37.4201286777) +``` + @@ -178,9 +236,10 @@ Returns the latitude and longitude coordinates of the given vertex. defaultValue="c" values={[ {label: 'C', value: 'c'}, - {label: 'Python', value: 'python'}, {label: 'Java', value: 'java'}, {label: 'JavaScript (Live)', value: 'javascript'}, + {label: 'Python', value: 'python'}, + {label: 'Shell', value: 'shell'}, ] }> @@ -189,13 +248,6 @@ Returns the latitude and longitude coordinates of the given vertex. int isValidVertex(H3Index vertex); ``` - - - -```py -h3.is_valid_vertex(vertex) -``` - @@ -218,6 +270,31 @@ function example() { } ``` + + + +```py +h3.is_valid_vertex(vertex) +``` + + + + +```sh +$ 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 Required. H3 Cell +``` + +```bash +$ h3 isValidVertex -c 255283463fffffff +true +``` + From 64d2c7fad9081de0c00370857f68b0a1587da128 Mon Sep 17 00:00:00 2001 From: David Ellis Date: Mon, 14 Oct 2024 15:56:59 -0500 Subject: [PATCH 2/5] Add h3 cli tool to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a2927753..06914d37e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The public API of this library consists of the functions declared in file [h3api.h.in](./src/h3lib/include/h3api.h.in). ## [Unreleased] +### Added +- `h3` binary for shell scripts ready for use (#931) + ### Fixed - Fixed compacting all or many resolution 1 cells (#919) From 51171b630e7682034fe4adfca32f240ce1a6fd06 Mon Sep 17 00:00:00 2001 From: David Ellis Date: Mon, 14 Oct 2024 17:15:38 -0500 Subject: [PATCH 3/5] Update CHANGELOG.md Co-authored-by: Isaac Brodsky --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06914d37e..f82b06bba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ The public API of this library consists of the functions declared in file ## [Unreleased] ### Added -- `h3` binary for shell scripts ready for use (#931) +- `h3` binary for shell scripts ready for use (#818, #826, #846, #923, #924, #931) ### Fixed - Fixed compacting all or many resolution 1 cells (#919) From 72a221cdd4bd8a231fcb81bdfb0451f28aa91771 Mon Sep 17 00:00:00 2001 From: David Ellis Date: Wed, 16 Oct 2024 11:09:02 -0500 Subject: [PATCH 4/5] Make cli output more regular --- src/apps/filters/h3.c | 30 +++++++++++++++--------------- website/docs/api/directededge.mdx | 4 ++-- website/docs/api/misc.mdx | 4 ++-- website/docs/api/vertex.mdx | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/apps/filters/h3.c b/src/apps/filters/h3.c index 5a76b1213..ac03f2459 100644 --- a/src/apps/filters/h3.c +++ b/src/apps/filters/h3.c @@ -223,7 +223,7 @@ SUBCOMMAND(getResolution, "Extracts the resolution (0 - 15) from the H3 cell") { // few functions that doesn't do any error handling (for some reason? I // don't see how this would ever be in a hot loop anywhere. int res = H3_EXPORT(getResolution)(cell); - printf("%i", res); + printf("%i\n", res); return E_SUCCESS; } @@ -243,7 +243,7 @@ SUBCOMMAND(getBaseCellNumber, // few functions that doesn't do any error handling (for some reason? I // don't see how this would ever be in a hot loop anywhere. int baseCell = H3_EXPORT(getBaseCellNumber)(cell); - printf("%i", baseCell); + printf("%i\n", baseCell); return E_SUCCESS; } @@ -267,7 +267,7 @@ SUBCOMMAND(stringToInt, "Converts an H3 index in string form to integer form") { free(rawCell); return err; } - printf("%" PRIu64, c); + printf("%" PRIu64 "\n", c); free(rawCell); return E_SUCCESS; } @@ -291,7 +291,7 @@ SUBCOMMAND(isValidCell, "Checks if the provided H3 index is actually valid") { Arg *args[] = {&isValidCellArg, &helpArg, &cellArg}; PARSE_SUBCOMMAND(argc, argv, args); bool isValid = H3_EXPORT(isValidCell)(cell); - printf("%s", isValid ? "true" : "false"); + printf("%s\n", isValid ? "true" : "false"); return E_SUCCESS; } @@ -311,7 +311,7 @@ SUBCOMMAND(isResClassIII, // few functions that doesn't do any error handling (for some reason? I // don't see how this would ever be in a hot loop anywhere. bool isClassIII = H3_EXPORT(isResClassIII)(cell); - printf("%s", isClassIII ? "true" : "false"); + printf("%s\n", isClassIII ? "true" : "false"); return E_SUCCESS; } @@ -332,7 +332,7 @@ SUBCOMMAND( // few functions that doesn't do any error handling (for some reason? I // don't see how this would ever be in a hot loop anywhere. bool is = H3_EXPORT(isPentagon)(cell); - printf("%s", is ? "true" : "false"); + printf("%s\n", is ? "true" : "false"); return E_SUCCESS; } @@ -373,6 +373,7 @@ SUBCOMMAND(getIcosahedronFaces, } printf("%i", faces[faceCount - 1]); } + printf("\n"); free(faces); return E_SUCCESS; } @@ -838,7 +839,7 @@ SUBCOMMAND(cellToChildrenSize, if (err) { return err; } - printf("%" PRId64, len); + printf("%" PRId64 "\n", len); return E_SUCCESS; } @@ -892,7 +893,7 @@ SUBCOMMAND( if (err) { return err; } - printf("%" PRId64, len); + printf("%" PRId64 "\n", len); return E_SUCCESS; } @@ -1625,8 +1626,7 @@ SUBCOMMAND(cellsToMultiPolygon, printf("]"); } } - printf("]"); - printf("\n"); + printf("]\n"); free(cells); H3_EXPORT(destroyLinkedMultiPolygon)(&out); return E_SUCCESS; @@ -1740,7 +1740,7 @@ SUBCOMMAND( if (err != E_SUCCESS) { return err; } - printf("[%" PRIx64 ", %" PRIx64 "]\n", out[0], out[1]); + printf("[\"%" PRIx64 "\", \"%" PRIx64 "\"]\n", out[0], out[1]); return E_SUCCESS; } @@ -1767,7 +1767,7 @@ SUBCOMMAND(originToDirectedEdges, if (hasPrinted) { printf(", "); } - printf("%" PRIx64, out[i]); + printf("\"%" PRIx64 "\"", out[i]); hasPrinted = true; } } @@ -1852,7 +1852,7 @@ SUBCOMMAND(cellToVertexes, if (hasPrinted) { printf(", "); } - printf("%" PRIx64, out[i]); + printf("\"%" PRIx64 "\"", out[i]); hasPrinted = true; } } @@ -2159,7 +2159,7 @@ SUBCOMMAND(getRes0Cells, "Returns all of the resolution 0 cells") { if (hasPrinted) { printf(", "); } - printf("%" PRIx64, out[i]); + printf("\"%" PRIx64 "\"", out[i]); hasPrinted = true; } } @@ -2192,7 +2192,7 @@ SUBCOMMAND(getPentagons, if (hasPrinted) { printf(", "); } - printf("%" PRIx64, out[i]); + printf("\"%" PRIx64 "\"", out[i]); hasPrinted = true; } } diff --git a/website/docs/api/directededge.mdx b/website/docs/api/directededge.mdx index 48799b9c1..5fe77948a 100644 --- a/website/docs/api/directededge.mdx +++ b/website/docs/api/directededge.mdx @@ -440,7 +440,7 @@ H3 4.1.0 ```bash $ h3 directedEdgeToCells -c 115283473fffffff -[85283473fffffff, 85283477fffffff] +["85283473fffffff", "85283477fffffff"] ``` @@ -512,7 +512,7 @@ H3 4.1.0 ```bash $ h3 originToDirectedEdges -c 85283473fffffff -[115283473fffffff, 125283473fffffff, 135283473fffffff, 145283473fffffff, 155283473fffffff, 165283473fffffff] +["115283473fffffff", "125283473fffffff", "135283473fffffff", "145283473fffffff", "155283473fffffff", "165283473fffffff"] ``` diff --git a/website/docs/api/misc.mdx b/website/docs/api/misc.mdx index db02b0eae..0255dba7c 100644 --- a/website/docs/api/misc.mdx +++ b/website/docs/api/misc.mdx @@ -998,7 +998,7 @@ H3 4.1.0 ```bash $ h3 getRes0Cells -[8001fffffffffff, 8003fffffffffff, 8005fffffffffff, 8007fffffffffff, 8009fffffffffff, 800bfffffffffff, 800dfffffffffff, 800ffffffffffff, 8011fffffffffff, 8013fffffffffff, 8015fffffffffff, 8017fffffffffff, 8019fffffffffff, 801bfffffffffff, 801dfffffffffff, 801ffffffffffff, 8021fffffffffff, 8023fffffffffff, 8025fffffffffff, 8027fffffffffff, 8029fffffffffff, 802bfffffffffff, 802dfffffffffff, 802ffffffffffff, 8031fffffffffff, 8033fffffffffff, 8035fffffffffff, 8037fffffffffff, 8039fffffffffff, 803bfffffffffff, 803dfffffffffff, 803ffffffffffff, 8041fffffffffff, 8043fffffffffff, 8045fffffffffff, 8047fffffffffff, 8049fffffffffff, 804bfffffffffff, 804dfffffffffff, 804ffffffffffff, 8051fffffffffff, 8053fffffffffff, 8055fffffffffff, 8057fffffffffff, 8059fffffffffff, 805bfffffffffff, 805dfffffffffff, 805ffffffffffff, 8061fffffffffff, 8063fffffffffff, 8065fffffffffff, 8067fffffffffff, 8069fffffffffff, 806bfffffffffff, 806dfffffffffff, 806ffffffffffff, 8071fffffffffff, 8073fffffffffff, 8075fffffffffff, 8077fffffffffff, 8079fffffffffff, 807bfffffffffff, 807dfffffffffff, 807ffffffffffff, 8081fffffffffff, 8083fffffffffff, 8085fffffffffff, 8087fffffffffff, 8089fffffffffff, 808bfffffffffff, 808dfffffffffff, 808ffffffffffff, 8091fffffffffff, 8093fffffffffff, 8095fffffffffff, 8097fffffffffff, 8099fffffffffff, 809bfffffffffff, 809dfffffffffff, 809ffffffffffff, 80a1fffffffffff, 80a3fffffffffff, 80a5fffffffffff, 80a7fffffffffff, 80a9fffffffffff, 80abfffffffffff, 80adfffffffffff, 80affffffffffff, 80b1fffffffffff, 80b3fffffffffff, 80b5fffffffffff, 80b7fffffffffff, 80b9fffffffffff, 80bbfffffffffff, 80bdfffffffffff, 80bffffffffffff, 80c1fffffffffff, 80c3fffffffffff, 80c5fffffffffff, 80c7fffffffffff, 80c9fffffffffff, 80cbfffffffffff, 80cdfffffffffff, 80cffffffffffff, 80d1fffffffffff, 80d3fffffffffff, 80d5fffffffffff, 80d7fffffffffff, 80d9fffffffffff, 80dbfffffffffff, 80ddfffffffffff, 80dffffffffffff, 80e1fffffffffff, 80e3fffffffffff, 80e5fffffffffff, 80e7fffffffffff, 80e9fffffffffff, 80ebfffffffffff, 80edfffffffffff, 80effffffffffff, 80f1fffffffffff, 80f3fffffffffff] +["8001fffffffffff", "8003fffffffffff", "8005fffffffffff", "8007fffffffffff", "8009fffffffffff", "800bfffffffffff", "800dfffffffffff", "800ffffffffffff", "8011fffffffffff", "8013fffffffffff", "8015fffffffffff", "8017fffffffffff", "8019fffffffffff", "801bfffffffffff", "801dfffffffffff", "801ffffffffffff", "8021fffffffffff", "8023fffffffffff", "8025fffffffffff", "8027fffffffffff", "8029fffffffffff", "802bfffffffffff", "802dfffffffffff", "802ffffffffffff", "8031fffffffffff", "8033fffffffffff", "8035fffffffffff", "8037fffffffffff", "8039fffffffffff", "803bfffffffffff", "803dfffffffffff", "803ffffffffffff", "8041fffffffffff", "8043fffffffffff", "8045fffffffffff", "8047fffffffffff", "8049fffffffffff", "804bfffffffffff", "804dfffffffffff", "804ffffffffffff", "8051fffffffffff", "8053fffffffffff", "8055fffffffffff", "8057fffffffffff", "8059fffffffffff", "805bfffffffffff", "805dfffffffffff", "805ffffffffffff", "8061fffffffffff", "8063fffffffffff", "8065fffffffffff", "8067fffffffffff", "8069fffffffffff", "806bfffffffffff", "806dfffffffffff", "806ffffffffffff", "8071fffffffffff", "8073fffffffffff", "8075fffffffffff", "8077fffffffffff", "8079fffffffffff", "807bfffffffffff", "807dfffffffffff", "807ffffffffffff", "8081fffffffffff", "8083fffffffffff", "8085fffffffffff", "8087fffffffffff", "8089fffffffffff", "808bfffffffffff", "808dfffffffffff", "808ffffffffffff", "8091fffffffffff", "8093fffffffffff", "8095fffffffffff", "8097fffffffffff", "8099fffffffffff", "809bfffffffffff", "809dfffffffffff", "809ffffffffffff", "80a1fffffffffff", "80a3fffffffffff", "80a5fffffffffff", "80a7fffffffffff", "80a9fffffffffff", "80abfffffffffff", "80adfffffffffff", "80affffffffffff", "80b1fffffffffff", "80b3fffffffffff", "80b5fffffffffff", "80b7fffffffffff", "80b9fffffffffff", "80bbfffffffffff", "80bdfffffffffff", "80bffffffffffff", "80c1fffffffffff", "80c3fffffffffff", "80c5fffffffffff", "80c7fffffffffff", "80c9fffffffffff", "80cbfffffffffff", "80cdfffffffffff", "80cffffffffffff", "80d1fffffffffff", "80d3fffffffffff", "80d5fffffffffff", "80d7fffffffffff", "80d9fffffffffff", "80dbfffffffffff", "80ddfffffffffff", "80dffffffffffff", "80e1fffffffffff", "80e3fffffffffff", "80e5fffffffffff", "80e7fffffffffff", "80e9fffffffffff", "80ebfffffffffff", "80edfffffffffff", "80effffffffffff", "80f1fffffffffff", "80f3fffffffffff"] ``` @@ -1131,7 +1131,7 @@ H3 4.1.0 ```bash $ h3 getPentagons -r 5 -[85080003fffffff, 851c0003fffffff, 85300003fffffff, 854c0003fffffff, 85620003fffffff, 85740003fffffff, 857e0003fffffff, 85900003fffffff, 85a60003fffffff, 85c20003fffffff, 85d60003fffffff, 85ea0003fffffff] +["85080003fffffff", "851c0003fffffff", "85300003fffffff", "854c0003fffffff", "85620003fffffff", "85740003fffffff", "857e0003fffffff", "85900003fffffff", "85a60003fffffff", "85c20003fffffff", "85d60003fffffff", "85ea0003fffffff"] ``` diff --git a/website/docs/api/vertex.mdx b/website/docs/api/vertex.mdx index 6abb0cce8..bf011c538 100644 --- a/website/docs/api/vertex.mdx +++ b/website/docs/api/vertex.mdx @@ -147,7 +147,7 @@ H3 4.1.0 ```bash $ h3 cellToVertexes -c 85283473fffffff -[22528340bfffffff, 235283447fffffff, 205283463fffffff, 255283463fffffff, 22528340ffffffff, 23528340bfffffff] +["22528340bfffffff", "235283447fffffff", "205283463fffffff", "255283463fffffff", "22528340ffffffff", "23528340bfffffff"] ``` From 3edc7b71a2764d3616a0ac2b1c38b9a2400b1827 Mon Sep 17 00:00:00 2001 From: David Ellis Date: Wed, 16 Oct 2024 11:24:11 -0500 Subject: [PATCH 5/5] Update tests --- tests/cli/cellToVertexes.txt | 2 +- tests/cli/directedEdgeToCells.txt | 2 +- tests/cli/getPentagons.txt | 2 +- tests/cli/getRes0Cells.txt | 2 +- tests/cli/originToDirectedEdges.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/cli/cellToVertexes.txt b/tests/cli/cellToVertexes.txt index 52f24bb79..c5a8153d4 100644 --- a/tests/cli/cellToVertexes.txt +++ b/tests/cli/cellToVertexes.txt @@ -1,2 +1,2 @@ -add_h3_cli_test(testCliCellToVertexes "cellToVertexes -c 85283473fffffff" "[22528340bfffffff, 235283447fffffff, 205283463fffffff, 255283463fffffff, 22528340ffffffff, 23528340bfffffff]") +add_h3_cli_test(testCliCellToVertexes "cellToVertexes -c 85283473fffffff" "[\"22528340bfffffff\", \"235283447fffffff\", \"205283463fffffff\", \"255283463fffffff\", \"22528340ffffffff\", \"23528340bfffffff\"]") add_h3_cli_test(testCliNotCellToVertexes "cellToVertexes -c 115283473fffffff 2>&1" "Error 5: Cell argument was not valid") diff --git a/tests/cli/directedEdgeToCells.txt b/tests/cli/directedEdgeToCells.txt index c5f23c695..3c118e464 100644 --- a/tests/cli/directedEdgeToCells.txt +++ b/tests/cli/directedEdgeToCells.txt @@ -1,2 +1,2 @@ -add_h3_cli_test(testCliDirectedEdgeToCells "directedEdgeToCells -c 115283473fffffff" "[85283473fffffff, 85283477fffffff]") +add_h3_cli_test(testCliDirectedEdgeToCells "directedEdgeToCells -c 115283473fffffff" "[\"85283473fffffff\", \"85283477fffffff\"]") add_h3_cli_test(testCliNotDirectedEdgeToCells "directedEdgeToCells -c 85283473fffffff 2>&1" "Error 6: Directed edge argument was not valid") diff --git a/tests/cli/getPentagons.txt b/tests/cli/getPentagons.txt index 60f3abe41..fae729218 100644 --- a/tests/cli/getPentagons.txt +++ b/tests/cli/getPentagons.txt @@ -1,2 +1,2 @@ -add_h3_cli_test(testCliGetPentagons "getPentagons -r 0" "[8009fffffffffff, 801dfffffffffff, 8031fffffffffff, 804dfffffffffff, 8063fffffffffff, 8075fffffffffff, 807ffffffffffff, 8091fffffffffff, 80a7fffffffffff, 80c3fffffffffff, 80d7fffffffffff, 80ebfffffffffff]") +add_h3_cli_test(testCliGetPentagons "getPentagons -r 0" "[\"8009fffffffffff\", \"801dfffffffffff\", \"8031fffffffffff\", \"804dfffffffffff\", \"8063fffffffffff\", \"8075fffffffffff\", \"807ffffffffffff\", \"8091fffffffffff\", \"80a7fffffffffff\", \"80c3fffffffffff\", \"80d7fffffffffff\", \"80ebfffffffffff\"]") add_h3_cli_test(testCliDontGetPentagons "getPentagons -r 20 2>&1" "Error 4: Resolution argument was outside of acceptable range") diff --git a/tests/cli/getRes0Cells.txt b/tests/cli/getRes0Cells.txt index 437c9fc1a..4887e274f 100644 --- a/tests/cli/getRes0Cells.txt +++ b/tests/cli/getRes0Cells.txt @@ -1 +1 @@ -add_h3_cli_test(testCliGetRes0Cells "getRes0Cells" "[8001fffffffffff, 8003fffffffffff, 8005fffffffffff, 8007fffffffffff, 8009fffffffffff, 800bfffffffffff, 800dfffffffffff, 800ffffffffffff, 8011fffffffffff, 8013fffffffffff, 8015fffffffffff, 8017fffffffffff, 8019fffffffffff, 801bfffffffffff, 801dfffffffffff, 801ffffffffffff, 8021fffffffffff, 8023fffffffffff, 8025fffffffffff, 8027fffffffffff, 8029fffffffffff, 802bfffffffffff, 802dfffffffffff, 802ffffffffffff, 8031fffffffffff, 8033fffffffffff, 8035fffffffffff, 8037fffffffffff, 8039fffffffffff, 803bfffffffffff, 803dfffffffffff, 803ffffffffffff, 8041fffffffffff, 8043fffffffffff, 8045fffffffffff, 8047fffffffffff, 8049fffffffffff, 804bfffffffffff, 804dfffffffffff, 804ffffffffffff, 8051fffffffffff, 8053fffffffffff, 8055fffffffffff, 8057fffffffffff, 8059fffffffffff, 805bfffffffffff, 805dfffffffffff, 805ffffffffffff, 8061fffffffffff, 8063fffffffffff, 8065fffffffffff, 8067fffffffffff, 8069fffffffffff, 806bfffffffffff, 806dfffffffffff, 806ffffffffffff, 8071fffffffffff, 8073fffffffffff, 8075fffffffffff, 8077fffffffffff, 8079fffffffffff, 807bfffffffffff, 807dfffffffffff, 807ffffffffffff, 8081fffffffffff, 8083fffffffffff, 8085fffffffffff, 8087fffffffffff, 8089fffffffffff, 808bfffffffffff, 808dfffffffffff, 808ffffffffffff, 8091fffffffffff, 8093fffffffffff, 8095fffffffffff, 8097fffffffffff, 8099fffffffffff, 809bfffffffffff, 809dfffffffffff, 809ffffffffffff, 80a1fffffffffff, 80a3fffffffffff, 80a5fffffffffff, 80a7fffffffffff, 80a9fffffffffff, 80abfffffffffff, 80adfffffffffff, 80affffffffffff, 80b1fffffffffff, 80b3fffffffffff, 80b5fffffffffff, 80b7fffffffffff, 80b9fffffffffff, 80bbfffffffffff, 80bdfffffffffff, 80bffffffffffff, 80c1fffffffffff, 80c3fffffffffff, 80c5fffffffffff, 80c7fffffffffff, 80c9fffffffffff, 80cbfffffffffff, 80cdfffffffffff, 80cffffffffffff, 80d1fffffffffff, 80d3fffffffffff, 80d5fffffffffff, 80d7fffffffffff, 80d9fffffffffff, 80dbfffffffffff, 80ddfffffffffff, 80dffffffffffff, 80e1fffffffffff, 80e3fffffffffff, 80e5fffffffffff, 80e7fffffffffff, 80e9fffffffffff, 80ebfffffffffff, 80edfffffffffff, 80effffffffffff, 80f1fffffffffff, 80f3fffffffffff]") +add_h3_cli_test(testCliGetRes0Cells "getRes0Cells" "[\"8001fffffffffff\", \"8003fffffffffff\", \"8005fffffffffff\", \"8007fffffffffff\", \"8009fffffffffff\", \"800bfffffffffff\", \"800dfffffffffff\", \"800ffffffffffff\", \"8011fffffffffff\", \"8013fffffffffff\", \"8015fffffffffff\", \"8017fffffffffff\", \"8019fffffffffff\", \"801bfffffffffff\", \"801dfffffffffff\", \"801ffffffffffff\", \"8021fffffffffff\", \"8023fffffffffff\", \"8025fffffffffff\", \"8027fffffffffff\", \"8029fffffffffff\", \"802bfffffffffff\", \"802dfffffffffff\", \"802ffffffffffff\", \"8031fffffffffff\", \"8033fffffffffff\", \"8035fffffffffff\", \"8037fffffffffff\", \"8039fffffffffff\", \"803bfffffffffff\", \"803dfffffffffff\", \"803ffffffffffff\", \"8041fffffffffff\", \"8043fffffffffff\", \"8045fffffffffff\", \"8047fffffffffff\", \"8049fffffffffff\", \"804bfffffffffff\", \"804dfffffffffff\", \"804ffffffffffff\", \"8051fffffffffff\", \"8053fffffffffff\", \"8055fffffffffff\", \"8057fffffffffff\", \"8059fffffffffff\", \"805bfffffffffff\", \"805dfffffffffff\", \"805ffffffffffff\", \"8061fffffffffff\", \"8063fffffffffff\", \"8065fffffffffff\", \"8067fffffffffff\", \"8069fffffffffff\", \"806bfffffffffff\", \"806dfffffffffff\", \"806ffffffffffff\", \"8071fffffffffff\", \"8073fffffffffff\", \"8075fffffffffff\", \"8077fffffffffff\", \"8079fffffffffff\", \"807bfffffffffff\", \"807dfffffffffff\", \"807ffffffffffff\", \"8081fffffffffff\", \"8083fffffffffff\", \"8085fffffffffff\", \"8087fffffffffff\", \"8089fffffffffff\", \"808bfffffffffff\", \"808dfffffffffff\", \"808ffffffffffff\", \"8091fffffffffff\", \"8093fffffffffff\", \"8095fffffffffff\", \"8097fffffffffff\", \"8099fffffffffff\", \"809bfffffffffff\", \"809dfffffffffff\", \"809ffffffffffff\", \"80a1fffffffffff\", \"80a3fffffffffff\", \"80a5fffffffffff\", \"80a7fffffffffff\", \"80a9fffffffffff\", \"80abfffffffffff\", \"80adfffffffffff\", \"80affffffffffff\", \"80b1fffffffffff\", \"80b3fffffffffff\", \"80b5fffffffffff\", \"80b7fffffffffff\", \"80b9fffffffffff\", \"80bbfffffffffff\", \"80bdfffffffffff\", \"80bffffffffffff\", \"80c1fffffffffff\", \"80c3fffffffffff\", \"80c5fffffffffff\", \"80c7fffffffffff\", \"80c9fffffffffff\", \"80cbfffffffffff\", \"80cdfffffffffff\", \"80cffffffffffff\", \"80d1fffffffffff\", \"80d3fffffffffff\", \"80d5fffffffffff\", \"80d7fffffffffff\", \"80d9fffffffffff\", \"80dbfffffffffff\", \"80ddfffffffffff\", \"80dffffffffffff\", \"80e1fffffffffff\", \"80e3fffffffffff\", \"80e5fffffffffff\", \"80e7fffffffffff\", \"80e9fffffffffff\", \"80ebfffffffffff\", \"80edfffffffffff\", \"80effffffffffff\", \"80f1fffffffffff\", \"80f3fffffffffff\"]") diff --git a/tests/cli/originToDirectedEdges.txt b/tests/cli/originToDirectedEdges.txt index 8c7c95e4b..de3cc25fb 100644 --- a/tests/cli/originToDirectedEdges.txt +++ b/tests/cli/originToDirectedEdges.txt @@ -1,2 +1,2 @@ -add_h3_cli_test(testCliOriginToDirectedEdges "originToDirectedEdges -c 85283473fffffff" "[115283473fffffff, 125283473fffffff, 135283473fffffff, 145283473fffffff, 155283473fffffff, 165283473fffffff]") +add_h3_cli_test(testCliOriginToDirectedEdges "originToDirectedEdges -c 85283473fffffff" "[\"115283473fffffff\", \"125283473fffffff\", \"135283473fffffff\", \"145283473fffffff\", \"155283473fffffff\", \"165283473fffffff\"]") add_h3_cli_test(testCliNotOriginToDirectedEdges "originToDirectedEdges -c 115283473fffffff 2>&1" "Error 5: Cell argument was not valid")