10 releases
0.2.5 | Oct 3, 2024 |
---|---|
0.2.4 | Apr 15, 2024 |
0.2.3 | Mar 25, 2024 |
0.2.1 | Oct 26, 2023 |
0.1.1 | Jan 15, 2023 |
#103 in Geospatial
223 downloads per month
71KB
1.5K
SLoC
h3o-cli — A CLI app exposing the h3o API for scripting
How to install
Pre-compiled binaries
You can download a pre-compiled executable for Linux, MacOS and Windows
operating systems from the
release page, then you
should copy that executable to a location from your $PATH
env.
Build Manually
If you prefer to build h3o-cli
manually, or a pre-compiled executable is not
provided for your platform, then you can build h3o-cli
from the source:
- Install Rust
- Run
cargo install h3o-cli
Usage
Each subcommand comes with its own help through -h/--help
.
There are two classes of output format for the commands:
- text format (text and JSON)
- geo format (KML and GeoJSON)
Most of the commands can either take a single input from the CLI options or a
list of input from stdin
.
Plain text output can be directly used as input for others, allowing command pipelines.
For geo output:
cellToLatLng
returns the center (Point
) of each indexcellToBoundary
returns the outline (LineString
) of each indexcellToPolygon
returns the shape (Polygon
) of contiguous indexes.
Examples
Prints information (coordinates, area, …) about on given cell:
h3o-cli cellInfo -i 844c001ffffffff
Decodes an index into its components:
h3o-cli indexDecode -i 21b1fb4644920fff --pretty
Creates a GeoJSON file containing the cell center points of all of the resolution 9 hexagons covering Uber HQ and the surrounding region of San Francisco.
h3o-cli cellToChildren --parent 86283082fffffff --resolution 9 \
| h3o-cli cellToLatLng -f geojson > uber9pts.geojson
Generates the set of indexes that cover Paris at resolution 11 and save the
compacted result in cells.txt
.
h3o-cli geomToCells -r 11 -f geojson < paris.geojson | h3o-cli compact > cells.txt
Prints the indexes from the 2-ring around 89283082ed7ffff
.
h3o-cli gridDisk -o 89283082ed7ffff -r 2
At resolution 7, prints the grid path that goes through a bunch of French cities and return the resulting KML.
h3o-cli latLngToCell -r 7 < cities-center.txt \
| h3o-cli gridPath \
| h3o-cli cellToBoundary -f kml
Load the shape of a city, compute the cell coverage at resolution 11 and save
the compressed result in city.cht
:
h3o-cli geomToCells -r 11 < city.geojson \
| h3o-cli compact \
| h3o-cli compress > city.cht
License
Dependencies
~13MB
~198K SLoC