Crate h3o

source ·
Expand description

The h3o library implements the H3 geospatial indexing system.

H3 is a geospatial indexing system using a hexagonal grid that can be (approximately) subdivided into finer and finer hexagonal grids, combining the benefits of a hexagonal grid with S2’s hierarchical subdivisions.

§Crate features

  • std - When enabled, this will cause h3o to use the standard library. In terms of APIs, std causes error types to implement the std::error::Error trait. Enabling std will also result in performance optimizations.

  • geo - When enabled, you’ll be able to convert lists of H3 cell indexes from and into geometric shapes. Also enables the GeoJSON support. Requires std.

  • serde - When enabled, H3 index types (cell, vertex and edge) derive serde traits.

§H3 to H3O mapping

For people used to the H3 API, here is the mapping to H3O.

§Indexing functions

H3H3O
latLngToCellLatLng::to_cell
cellToLatLngLatLng::from
cellToBoundaryCellIndex::boundary

§Index inspection functions

H3H3O
getResolutionCellIndex::resolution
getBaseCellNumberCellIndex::base_cell
stringToH3str::parse
h3ToStringToString::to_string
isValidCellCellIndex::try_from
isResClassIIIResolution::is_class3
isPentagonCellIndex::is_pentagon
getIcosahedronFacesCellIndex::icosahedron_faces
maxFaceCountCellIndex::max_face_count

§Grid traversal functions

§Hierarchical grid functions

H3H3O
cellToParentCellIndex::parent
cellToChildrenCellIndex::children
cellToChildrenSizeCellIndex::children_count
cellToCenterChildCellIndex::center_child
cellToChildPosCellIndex::child_position
childPosToCellCellIndex::child_at
compactCellsCellIndex::compact
uncompactCellsCellIndex::uncompact
uncompactCellsSizeCellIndex::uncompact_size

§Region functions

H3H3O
polygonToCellsgeom::ToCells::to_cells
maxPolygonToCellsSizegeom::ToCells::max_cells_count
h3SetToLinkedGeogeom::ToGeo::to_geom
destroyLinkedPolygonN/A

§Directed edge functions

H3H3O
areNeighborCellsCellIndex::is_neighbor_with
cellsToDirectedEdgeCellIndex::edge
isValidDirectedEdgeDirectedEdgeIndex::try_from
getDirectedEdgeOriginDirectedEdgeIndex::origin
getDirectedEdgeDestinationDirectedEdgeIndex::destination
directedEdgeToCellsDirectedEdgeIndex::cells
originToDirectedEdgesCellIndex::edges
directedEdgeToBoundaryDirectedEdgeIndex::boundary

§Vertex functions

H3H3O
cellToVertexCellIndex::vertex
cellToVertexesCellIndex::vertexes
vertexToLatLngLatLng::from
isValidVertexVertexIndex::try_from

§Miscellaneous H3 functions

H3H3O
degsToRadsf64::to_radians
radsToDegsf64::to_degrees
getHexagonAreaAvgKm2Resolution::area_km2
getHexagonAreaAvgM2Resolution::area_m2
cellAreaKm2CellIndex::area_km2
cellAreaM2CellIndex::area_m2
cellAreaRads2CellIndex::area_rads2
getHexagonEdgeLengthAvgKmResolution::edge_length_km
getHexagonEdgeLengthAvgMResolution::edge_length_m
edgeLengthKmDirectedEdgeIndex::length_km
edgeLengthMDirectedEdgeIndex::length_m
edgeLengthRadsDirectedEdgeIndex::length_rads
getNumCellsResolution::cell_count
getRes0CellsCellIndex::base_cells
res0CellCountBaseCell::count
getPentagonsResolution::pentagons
pentagonCountResolution::pentagon_count
greatCircleDistanceKmLatLng::distance_km
greatCircleDistanceMLatLng::distance_m
greatCircleDistanceRadsLatLng::distance_rads

Modules§

  • H3O error types.
  • Bridge between H3 entities and geometrical shapes.

Structs§

  • One of the 122 base cells.
  • Boundary in latitude/longitude.
  • Represents a cell (hexagon or pentagon) in the H3 grid system at a particular resolution.
  • IJ hexagon coordinates.
  • Represents a single directed edge between two cells (an “origin” cell and a neighboring “destination” cell).
  • Edge of an H3 cell.
  • An icosahedron face.
  • A set of icosahedron faces.
  • Latitude/longitude.
  • IJ coordinates anchored by an origin.
  • Vertex of an H3 cell.
  • Represents a single topological vertex in H3 grid system, shared by three cells.

Enums§

Constants§

Functions§

  • Maximum number of indices produced by the grid disk algorithm with the given k.