### Example: succ Method Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Demonstrates getting the next finer resolution using the `succ` method. ```rust assert_eq!(h3o::Resolution::Eleven.succ(), Some(h3o::Resolution::Twelve)); assert!(h3o::Resolution::Fifteen.succ().is_none()); ``` -------------------------------- ### Example: pred Method Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Shows how to get the next coarser resolution using the `pred` method. ```rust assert_eq!(h3o::Resolution::Eleven.pred(), Some(h3o::Resolution::Ten)); assert!(h3o::Resolution::Zero.pred().is_none()); ``` -------------------------------- ### Example: area_km2 Method Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Shows how to get the average hexagon area in square kilometers for a specific resolution. ```rust let area = h3o::Resolution::Three.area_km2(); ``` -------------------------------- ### Example: Constructing VertexIndex from u64 Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/vertex_index.md Demonstrates how to construct a VertexIndex from a raw 64-bit H3 vertex index. This example uses the try_from method. ```rust let vertex = h3o::VertexIndex::try_from(0x2a1fb46622dffff)?; ``` -------------------------------- ### Example: Retrieving Cells from VertexIndex Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/vertex_index.md Shows how to get the three adjacent CellIndex values that meet at a specific VertexIndex and print them. ```rust let vertex = h3o::VertexIndex::try_from(0x2a1fb46622dffff)?; let [c1, c2, c3] = vertex.cells(); println!("Cell 1: {}", c1); println!("Cell 2: {}", c2); println!("Cell 3: {}", c3); ``` -------------------------------- ### Usage Pattern: Creating Resolution 0 Cells Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/base_cell.md A practical example showing how to get all resolution 0 cells and iterate through them, identifying whether each is a pentagon or hexagon. ```rust use h3o::{CellIndex, BaseCell}; // Get all resolution 0 cells let res0_cells: Vec<_> = h3o::CellIndex::base_cells().collect(); // Find properties of each for cell in res0_cells { let base = cell.base_cell(); println!( "Base cell {}: {}", base, if base.is_pentagon() { "Pentagon" } else { "Hexagon" } ); } ``` -------------------------------- ### Example: range Method Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Illustrates creating and collecting a range of resolutions, including reverse iteration. ```rust let resolutions: Vec<_> = h3o::Resolution::range( h3o::Resolution::Five, h3o::Resolution::Seven ).collect(); assert_eq!( resolutions, vec![h3o::Resolution::Five, h3o::Resolution::Six, h3o::Resolution::Seven] ); // Reverse order with rev() let reversed: Vec<_> = h3o::Resolution::range(h3o::Resolution::Zero, h3o::Resolution::Two) .rev() .collect(); ``` -------------------------------- ### Find Path Between Cells (Example) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/INDEX.md Calculates the grid distance between two H3 cells and retrieves the sequence of cells forming the shortest path between them. Requires `CellIndex` to be defined for both start and end points. ```rust let start = CellIndex::try_from(0x8a1fb46622dffff)?; let end = CellIndex::try_from(0x8a1fb466222ffff)?; let distance = start.grid_distance(end)?; let path: Vec<_> = start.grid_path_cells(end)?.collect(); println!("Distance: {} cells", distance); println!("Path length: {}", path.len()); ``` -------------------------------- ### Example: area_m2 Method Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Illustrates retrieving the average hexagon area in square meters for a given resolution. ```rust let area = h3o::Resolution::Three.area_m2(); ``` -------------------------------- ### Example of CompactionError Trigger Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/errors.md Provides an example that can trigger a CompactionError by attempting to compact a list of cells with identical H3 indices but different resolutions. ```rust let mut cells = vec![ h3o::CellIndex::try_from(0x8a1fb46622dffff)?, h3o::CellIndex::try_from(0x8a1fb46622dffff)?, ]; h3o::CellIndex::compact(&mut cells)?; ``` -------------------------------- ### Get Cell Boundary (Example) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/INDEX.md Retrieves the boundary vertices of an H3 cell. The boundary is returned as a slice of `LatLng` points, which can be iterated to access individual vertices. ```rust let cell = CellIndex::try_from(0x8a1fb46622dffff)?; let boundary = cell.boundary(); for (i, vertex) in boundary.iter().enumerate() { println!("Vertex {}: lat={}, lng={}", i, vertex.lat(), vertex.lng()); } ``` -------------------------------- ### Get First Cell at a Resolution Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Returns the first (smallest) cell at a given resolution. Use to obtain the starting cell for a specific resolution level. ```rust let first = h3o::CellIndex::first(h3o::Resolution::Five); ``` -------------------------------- ### Compute Cell Area (Example) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/INDEX.md Calculates the area of an H3 cell in both square kilometers and square meters. Also demonstrates how to get the average area for a given resolution. ```rust let cell = CellIndex::try_from(0x8a1fb46622dffff)?; let area_km2 = cell.area_km2(); let area_m2 = cell.area_m2(); // Or get average for resolution let avg_area = Resolution::Nine.area_km2(); ``` -------------------------------- ### Example: area_rads2 Method Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Demonstrates retrieving the average hexagon area in square radians for a given resolution. ```rust let area = h3o::Resolution::Three.area_rads2(); ``` -------------------------------- ### Example: Parse Resolution from String Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Shows how to parse a Resolution enum variant from a string slice. ```rust use std::str::FromStr; let res = h3o::Resolution::from_str("5")?; # Ok::<(), h3o::error::InvalidResolution>(()) ``` -------------------------------- ### Example: Try From u8 for Resolution Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Demonstrates converting an unsigned 8-bit integer to a Resolution enum variant. ```rust let res = h3o::Resolution::try_from(5)?; assert_eq!(res, h3o::Resolution::Five); # Ok::<(), h3o::error::InvalidResolution>(()) ``` -------------------------------- ### Navigate H3 Hierarchy (Example) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/INDEX.md Demonstrates moving up the H3 hierarchy to a parent cell at a coarser resolution and collecting all children cells at a finer resolution. Also shows how to find a cell's position among its siblings. ```rust let cell = CellIndex::try_from(0x8a1fb46622dffff)?; // Go up to resolution 5 let parent = cell.parent(Resolution::Five)?; // Get all children at resolution 12 let children: Vec<_> = cell.children(Resolution::Twelve).collect(); // Get child position within parent if let Some(pos) = cell.child_position(Resolution::Ten) { println!("Child position: {}", pos); } ``` -------------------------------- ### Find Neighbors and Disk (Example) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/INDEX.md Shows how to find direct neighbors of a cell using `grid_ring(1)` and all cells within a radius of 2 using `grid_disk(2)`. Assumes `CellIndex` is already defined. ```rust let cell = CellIndex::try_from(0x8a1fb46622dffff)?; // Direct neighbors only let neighbors: Vec<_> = cell.grid_ring(1); // All cells within radius k let disk: Vec<_> = cell.grid_disk(2); ``` -------------------------------- ### Get Cell Boundaries Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/00_START_HERE.md Retrieves the boundary vertices for a given H3 cell index. The example iterates through the vertices and prints their latitude and longitude. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let boundary = cell.boundary(); for vertex in boundary.iter() { println!("Corner: ({}, {})", vertex.lat(), vertex.lng()); } ``` -------------------------------- ### Example: is_class3 Method Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Illustrates the usage of the `is_class3` method to check resolution type. ```rust assert!(h3o::Resolution::Eleven.is_class3()); assert!(!h3o::Resolution::Two.is_class3()); ``` -------------------------------- ### Convert Coordinates to Cell (Example) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/INDEX.md Demonstrates converting a `LatLng` coordinate to an H3 `CellIndex` at `Resolution::Nine`. Includes necessary imports and printing the resulting cell index. ```rust use h3o::{LatLng, Resolution}; let coord = LatLng::new(51.5074, -0.1278)?; let cell = coord.to_cell(Resolution::Nine); println!("Cell: {}", cell); ``` -------------------------------- ### H3 Grid Navigation Examples Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/README.md Illustrates common grid navigation operations including finding neighbors, calculating grid distance between cells, and retrieving cells along a path. Assumes `cell` and `CellIndex` are already defined. ```rust // Find neighbors let neighbors: Vec<_> = cell.grid_ring(1); // Get distance let other = CellIndex::try_from(0x8a1fb466222ffff)?; let dist = cell.grid_distance(other)?; // Get path for cell_on_path in cell.grid_path_cells(other)? { println!("Step: {}", cell_on_path); } ``` -------------------------------- ### H3 Index Type Detection Example Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/module_functions.md Shows how to determine the type of an H3 index (Cell, Directed Edge, or Vertex) by attempting to parse it with each respective `try_from` method. Also demonstrates using `is_valid_index` for a preliminary check. ```rust let value = 0x8a1fb46622dffff_u64; match h3o::CellIndex::try_from(value) { Ok(cell) => println!("Cell: {}", cell), Err(_) => { match h3o::DirectedEdgeIndex::try_from(value) { Ok(edge) => println!("Edge: {}", edge), Err(_) => { match h3o::VertexIndex::try_from(value) { Ok(vertex) => println!("Vertex: {}", vertex), Err(_) => println!("Invalid index"), } } } } } if h3o::is_valid_index(value) { println!("Some kind of valid H3 index"); } ``` -------------------------------- ### Configure H3O for GIS Application Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/configuration.md Includes H3O with `geo` and `serde` features, along with `geo` and `serde_json` dependencies. This setup is ideal for GIS applications that require tiling GeoJSON polygons and serializing results. ```toml [dependencies] h3o = { version = "0.11", features = ["geo", "serde"] } geo = "0.33" serde_json = "1.0" ``` -------------------------------- ### range Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Creates an iterator over resolutions within an inclusive range [start, end]. ```APIDOC ## range ### Description Creates an iterator over resolutions within an inclusive range [start, end]. ### Method ```rust pub fn range( start: Self, end: Self, ) -> impl DoubleEndedIterator ``` ### Parameters #### Path Parameters - **start** (Resolution) - Required - Lower bound (inclusive) - **end** (Resolution) - Required - Upper bound (inclusive) ### Returns `impl DoubleEndedIterator` - Bidirectional iterator. ### Example ```rust let resolutions: Vec<_> = h3o::Resolution::range( h3o::Resolution::Five, h3o::Resolution::Seven ).collect(); assert_eq!( resolutions, vec![h3o::Resolution::Five, h3o::Resolution::Six, h3o::Resolution::Seven] ); // Reverse order with rev() let reversed: Vec<_> = h3o::Resolution::range(h3o::Resolution::Zero, h3o::Resolution::Two) .rev() .collect(); ``` ``` -------------------------------- ### Validate LatLng Creation Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/errors.md Provides example cases for validating the creation of LatLng coordinates, including checks for NaN, infinity, and valid coordinate pairs. This helps ensure robust handling of geographical data. ```rust assert!(h3o::LatLng::new(f64::NAN, 10.).is_err()); assert!(h3o::LatLng::new(10., f64::INFINITY).is_err()); assert!(h3o::LatLng::new(48.864716, 2.349014).is_ok()); ``` -------------------------------- ### Get Next Finer Resolution Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Returns the next finer resolution. Returns `None` if the current resolution is already the maximum (15). ```rust pub fn succ(self) -> Option ``` -------------------------------- ### Iterate Over Resolution Range Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Creates an iterator over a range of resolutions, inclusive of both start and end points. Supports reverse iteration. ```rust pub fn range( start: Self, end: Self, ) -> impl DoubleEndedIterator ``` -------------------------------- ### Get Origin Cell of DirectedEdgeIndex Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/directed_edge_index.md Returns the origin cell of this directed edge. This is the starting cell of the directed edge. ```rust pub fn origin(self) -> CellIndex ``` ```rust let edge = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?; let start = edge.origin(); ``` -------------------------------- ### Configure Documentation Build for docs.rs Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/configuration.md Configures the crate to generate documentation on docs.rs with all features enabled. This ensures documentation includes types from various optional features like `geo`, `serde`, and `typed_floats`. ```toml [package.metadata.docs.rs] all-features = true ``` -------------------------------- ### Create and Use LatLng Coordinates Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/INDEX.md Demonstrates creating a LatLng coordinate and accessing its properties. Supports distance calculations and conversion to H3 cells. Requires the `h3o` crate. ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lat(), 48.864716); let distance_km = coord.distance_km(other); let cell = coord.to_cell(h3o::Resolution::Nine); ``` -------------------------------- ### Get Cells within Grid Disk (Fast Iterator) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Returns an iterator over cells within a grid disk, including potential invalid cells (None). This is a faster but less safe alternative to `grid_disk`. ```rust pub fn grid_disk_fast(self, k: u32) -> impl Iterator> ``` ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let disk: Vec<_> = cell.grid_disk_fast(1) .filter_map(|c| c) .collect(); ``` -------------------------------- ### Clone and Test h3o Project Source: https://github.com/hydroniumlabs/h3o/blob/master/CONTRIBUTING.md Clone the h3o repository and run initial tests to set up the development environment. ```shell git clone https://github.com/HydroniumLabs/h3o cd h3o cargo test ``` -------------------------------- ### Run All Tests with Features Source: https://github.com/hydroniumlabs/h3o/blob/master/CONTRIBUTING.md Execute all tests in the project, including those enabled by all features. ```shell cargo test --all-features ``` -------------------------------- ### Get Directed Edge Between Cells Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Returns the directed edge from this cell to a neighboring cell. Use when you need to check for adjacency and get the specific edge index. ```rust let cell1 = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let cell2 = h3o::CellIndex::try_from(0x8a1fb466222ffff)?; if let Some(edge) = cell1.edge(cell2) { println!("Edge exists"); } ``` -------------------------------- ### Get Vertex Index by Position Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Returns the vertex index for a specific vertex position (0-5) of this cell. Use to get a unique identifier for a cell's vertex. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let vertex = cell.vertex(h3o::Vertex::Zero)?; ``` -------------------------------- ### Cell Construction with Directions Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/direction.md Demonstrates how to construct a CellIndex using a BaseCell and a sequence of directions to specify its path and resolution. ```rust use h3o::{CellIndex, BaseCell, Direction}; // Create a cell at resolution 3 with specific directions let cell = CellIndex::from_raw_parts( BaseCell::try_from(42)?, &[ Direction::K, // Resolution 1 Direction::Center, // Resolution 2 Direction::IJ, // Resolution 3 ] )?; ``` -------------------------------- ### LatLng::lng_radians Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Gets the longitude of the coordinate in radians. ```APIDOC ## LatLng::lng_radians ### Description Gets the longitude of the coordinate in radians. ### Returns - `f64` - Longitude in radians. ### Example ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lng_radians(), 0.04099802847544208); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` ``` -------------------------------- ### Format Code in Project Source: https://github.com/hydroniumlabs/h3o/blob/master/CONTRIBUTING.md Use the nightly toolchain to format all code within the project according to standard Rust style guidelines. ```shell cargo +nightly fmt --all ``` -------------------------------- ### LatLng::lat_radians Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Gets the latitude of the coordinate in radians. ```APIDOC ## LatLng::lat_radians ### Description Gets the latitude of the coordinate in radians. ### Returns - `f64` - Latitude in radians. ### Example ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lat_radians(), 0.8528501822519535); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` ``` -------------------------------- ### LatLng::lng Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Gets the longitude of the coordinate in degrees. ```APIDOC ## LatLng::lng ### Description Gets the longitude of the coordinate in degrees. ### Returns - `f64` - Longitude (-180 to 180). ### Example ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lng(), 2.349014); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` ``` -------------------------------- ### LatLng::lat Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Gets the latitude of the coordinate in degrees. ```APIDOC ## LatLng::lat ### Description Gets the latitude of the coordinate in degrees. ### Returns - `f64` - Latitude (-90 to 90). ### Example ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lat(), 48.864716); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` ``` -------------------------------- ### Constructor: new Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/boundary.md Creates an empty Boundary, primarily intended for testing purposes. In normal usage, boundaries are obtained via `CellIndex::boundary()`. ```APIDOC ## new ```rust pub fn new() -> Self ``` ### Description Create an empty boundary (primarily for testing). ### Returns `Boundary` - Empty boundary with 0 vertices. ### Example ```rust let mut boundary = h3o::Boundary::new(); ``` ``` -------------------------------- ### pentagon_count Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Get the number of pentagons, which is constant across all resolutions. ```APIDOC ## pentagon_count ### Description Number of pentagons (same for all resolutions). ### Method This is a static method on the Resolution enum. ### Parameters None ### Returns - **u8** - Always 12. ### Request Example ```rust assert_eq!(h3o::Resolution::pentagon_count(), 12); ``` ``` -------------------------------- ### Get BaseCell from CellIndex Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/base_cell.md Demonstrates how to obtain the BaseCell from any H3 CellIndex. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let base = cell.base_cell(); ``` -------------------------------- ### cell_count Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Get the total number of unique H3 cells at a given resolution. ```APIDOC ## cell_count ### Description Total number of unique H3 cells at this resolution. Returns 2 + 120 * 7^resolution. ### Method This is a method on the Resolution enum. ### Parameters None ### Returns - **u64** - Cell count at resolution. ### Request Example ```rust let count = h3o::Resolution::Three.cell_count(); assert_eq!(count, 41_162); ``` ``` -------------------------------- ### Configure H3O for CLI Tool Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/configuration.md Includes H3O with all default features and the `clap` dependency for command-line argument parsing. This configuration is suitable for CLI tools that utilize the full H3O functionality with standard library support. ```toml [dependencies] h3o = "0.11" clap = "4.0" ``` -------------------------------- ### edge_length_m Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Get the average hexagon edge length at a given resolution in meters. ```APIDOC ## edge_length_m ### Description Average hexagon edge length at this resolution in meters. ### Method This is a method on the Resolution enum. ### Parameters None ### Returns - **f64** - Edge length in meters. ### Request Example ```rust let edge_len = h3o::Resolution::Three.edge_length_m(); ``` ``` -------------------------------- ### edge_length_km Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Get the average hexagon edge length at a given resolution in kilometers. ```APIDOC ## edge_length_km ### Description Average hexagon edge length at this resolution in kilometers. ### Method This is a method on the Resolution enum. ### Parameters None ### Returns - **f64** - Edge length in km. ### Request Example ```rust let edge_len = h3o::Resolution::Three.edge_length_km(); ``` ``` -------------------------------- ### Basic H3 Indexing and Properties Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/README.md Demonstrates how to create an H3 CellIndex from geographic coordinates and access its basic properties like resolution and base cell. Requires importing `LatLng` and `Resolution` from the `h3o` crate. ```rust use h3o::{LatLng, Resolution}; // Create coordinate and convert to H3 cell let coord = LatLng::new(51.5074, -0.1278)?; let cell = coord.to_cell(Resolution::Nine); // Get properties println!("Resolution: {:?}", cell.resolution()); println!("Base cell: {}", cell.base_cell()); ``` -------------------------------- ### edge_length_rads Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Get the average hexagon edge length at a given resolution in radians. ```APIDOC ## edge_length_rads ### Description Average hexagon edge length at this resolution in radians. ### Method This is a method on the Resolution enum. ### Parameters None ### Returns - **f64** - Edge length in radians. ``` -------------------------------- ### Get Longitude in Radians Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Retrieves the longitude component of a LatLng coordinate in radians. ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lng_radians(), 0.04099802847544208); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` -------------------------------- ### Display and Debug Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md LatLng implements Display for formatted degree output and Debug for both degrees and radians. ```APIDOC ## Display & Debug ### Description LatLng implements `Display` (shows degrees with up to 10 decimals) and `Debug` (shows both degrees and radians). ### Example ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; println!("{}", coord); // Display format: degrees println!("{:?}", coord); // Debug format: degrees and radians ``` ``` -------------------------------- ### Get Latitude in Radians Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Retrieves the latitude component of a LatLng coordinate in radians. ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lat_radians(), 0.8528501822519535); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` -------------------------------- ### Get DirectedEdgeIndex Length in Meters Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/directed_edge_index.md Returns the length of the shared edge in meters. ```rust pub fn length_m(self) -> f64 ``` ```rust let edge = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?; let length_m = edge.length_m(); ``` -------------------------------- ### Iterate Over Boundary Vertices and Edges Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/boundary.md Demonstrates iterating over the vertices of a Boundary in both forward and reverse order, as well as iterating over consecutive pairs of vertices to represent edges. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let boundary = cell.boundary(); // Forward iteration for vertex in boundary.iter() { println!("{}", vertex); } // Reverse iteration for vertex in boundary.iter().rev() { println!("{}", vertex); } // Windowed iteration (pairs of consecutive vertices for edges) for window in boundary.windows(2) { let edge = (window[0], window[1]); } ``` -------------------------------- ### Get DirectedEdgeIndex Length in Kilometers Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/directed_edge_index.md Returns the length of the shared edge in kilometers. ```rust pub fn length_km(self) -> f64 ``` ```rust let edge = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?; let length_km = edge.length_km(); println!("Edge length: {} km", length_km); ``` -------------------------------- ### Get Longitude in Degrees Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Retrieves the longitude component of a LatLng coordinate in degrees. ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lng(), 2.349014); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` -------------------------------- ### Get DirectedEdgeIndex Length in Radians Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/directed_edge_index.md Returns the length of the shared edge in radians. ```rust pub fn length_rads(self) -> f64 ``` ```rust let edge = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?; let length = edge.length_rads(); ``` -------------------------------- ### Angle Conversion Utilities Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/module_functions.md Demonstrates using Rust's standard library f64 methods for converting between degrees and radians. These are used internally for coordinate transformations. ```rust // Degrees to radians let radians = degrees.to_radians(); // Radians to degrees let degrees = radians.to_degrees(); ``` -------------------------------- ### Iteration Support Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/boundary.md Standard slice iteration methods are available for Boundary, allowing forward, reverse, and windowed iteration over its vertices. ```APIDOC ## Iteration Use standard slice iteration methods: ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let boundary = cell.boundary(); // Forward iteration for vertex in boundary.iter() { println!("{}", vertex); } // Reverse iteration for vertex in boundary.iter().rev() { println!("{}", vertex); } // Windowed iteration (pairs of consecutive vertices for edges) for window in boundary.windows(2) { let edge = (window[0], window[1]); } ``` ``` -------------------------------- ### Get Latitude in Degrees Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Retrieves the latitude component of a LatLng coordinate in degrees. ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lat(), 48.864716); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` -------------------------------- ### Analyze Cell Boundary Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/boundary.md This snippet shows how to obtain a cell's boundary, extract its vertices, compute its approximate perimeter in kilometers, and check if it's a pentagon. It requires the `h3o` crate and uses `CellIndex::try_from` to create a cell index. ```rust use h3o::CellIndex; fn analyze_cell_boundary(cell_index: u64) -> Result<(), Box> { let cell = CellIndex::try_from(cell_index)?; let boundary = cell.boundary(); // Get vertices let vertices: Vec<_> = boundary.iter().copied().collect(); println!("Cell has {} vertices", vertices.len()); // Compute perimeter (approximate) let mut perimeter = 0.0; for window in boundary.windows(2) { let dist = window[0].distance_km(window[1]); perimeter += dist; } println!("Perimeter: {} km", perimeter); // Check if pentagon if cell.is_pentagon() { println!("This is a pentagonal cell"); } Ok(()) } ``` -------------------------------- ### Convert DirectedEdgeIndex to CellIndex Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/directed_edge_index.md Get the origin cell of the edge by converting a DirectedEdgeIndex to a CellIndex. ```rust impl From for CellIndex { fn from(edge: DirectedEdgeIndex) -> Self } ``` ```rust let edge = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?; let origin = h3o::CellIndex::from(edge); ``` -------------------------------- ### Check Code Formatting Source: https://github.com/hydroniumlabs/h3o/blob/master/CONTRIBUTING.md Use the nightly toolchain to check for code formatting issues across the entire project without modifying files. ```shell cargo +nightly fmt --all -- --check ``` -------------------------------- ### H3o Configuration with Serialization Only Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/configuration.md Enables only the 'serde' feature for H3o, providing serialization without geometric operations. Ideal for scenarios where H3 indices are exchanged as JSON with minimal dependencies. ```toml [dependencies] h3o = { version = "0.11", features = ["serde"] } ``` -------------------------------- ### Display Boundary as String Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/boundary.md Prints a Boundary to the console using its Display implementation. The output format shows vertices separated by hyphens. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let boundary = cell.boundary(); println!("{}", boundary); // Output: [(lat,lng)-(lat,lng)-...] ``` -------------------------------- ### Catching CompactionError Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/errors.md Demonstrates how to catch and handle a CompactionError when attempting to compact a list of cells using `CellIndex::compact`. ```rust match h3o::CellIndex::compact(&mut cells) { Ok(()) => println!("Compaction successful"), Err(CompactionError) => println!("Cannot compact cells"), } ``` -------------------------------- ### Run Clippy for Linting Source: https://github.com/hydroniumlabs/h3o/blob/master/CONTRIBUTING.md Execute Clippy to check for common Rust code errors and style issues across all targets and features. ```shell cargo clippy --all-targets --all-features ``` -------------------------------- ### Standard H3o Configuration (Default) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/configuration.md The default H3o configuration, providing full feature set with standard library support. This is enabled by default when adding 'h3o' as a dependency. ```toml [dependencies] h3o = "0.11" ``` -------------------------------- ### Get Pentagon Count Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Retrieve the number of pentagons in the H3 system. This count is constant across all resolutions. ```rust pub const fn pentagon_count() -> u8 ``` ```rust assert_eq!(h3o::Resolution::pentagon_count(), 12); ``` -------------------------------- ### Navigate H3 Cell Hierarchy Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/00_START_HERE.md Demonstrates navigating the H3 cell hierarchy by finding the parent cell at a coarser resolution and collecting children cells at a finer resolution. ```rust // Get parent at coarser resolution let parent = cell.parent(h3o::Resolution::Five)?; // Get children at finer resolution let children: Vec<_> = cell.children(h3o::Resolution::Eleven).collect(); ``` -------------------------------- ### Display Implementation Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/boundary.md Boundaries implement the `Display` trait, providing a string representation of their vertices separated by hyphens. ```APIDOC ## Display Boundaries implement `Display`, showing vertices separated by hyphens: ```rust impl fmt::Display for Boundary { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result } ``` ### Example ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let boundary = cell.boundary(); println!("{}", boundary); // Output: [(lat,lng)-(lat,lng)-...] ``` ``` -------------------------------- ### Get Both Cells of DirectedEdgeIndex Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/directed_edge_index.md Returns an array containing both the origin and destination cells that form this directed edge. ```rust pub fn cells(self) -> [CellIndex; 2] ``` ```rust let edge = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?; let [origin, destination] = edge.cells(); ``` -------------------------------- ### succ Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Returns the next finer resolution. Returns `None` if the current resolution is already the maximum (15). ```APIDOC ## succ ### Description Returns the next finer resolution. Returns `None` if the current resolution is already the maximum (15). ### Method ```rust pub fn succ(self) -> Option ``` ### Returns `Option` - Next resolution or `None` if already at 15. ### Example ```rust assert_eq!(h3o::Resolution::Eleven.succ(), Some(h3o::Resolution::Twelve)); assert!(h3o::Resolution::Fifteen.succ().is_none()); ``` ``` -------------------------------- ### Get Iterator for Base Cells Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Returns an iterator over all base cells (resolution 0). There are 122 base cells in total. ```rust let base_cells: Vec<_> = h3o::CellIndex::base_cells().collect(); ``` -------------------------------- ### CellIndex::direction_at Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Gets the direction from a parent cell to this cell at a specified resolution. This is useful for understanding the hierarchical relationship between cells. ```APIDOC ## CellIndex::direction_at ### Description Returns the direction at a given resolution within this cell's hierarchy. ### Method `direction_at(self, resolution: Resolution) -> Option` ### Parameters #### Path Parameters - **resolution** (`Resolution`) - Required - Target resolution (must be 1-15 and ≤ cell's resolution) ### Response #### Success Response - `Option` - The direction at that resolution, or `None` if out of bounds. ### Request Example ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; assert_eq!(cell.direction_at(h3o::Resolution::Five), Some(h3o::Direction::K)); ``` ``` -------------------------------- ### Get CellIndex Resolution Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Retrieve the resolution of a CellIndex. The resolution indicates the level of detail of the hexagon or pentagon in the H3 grid. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; assert_eq!(cell.resolution(), h3o::Resolution::Ten); ``` -------------------------------- ### Create LatLng from Radians Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Constructs a LatLng coordinate from latitude and longitude values in radians. Returns an error if the input values are non-finite. ```rust let coord = h3o::LatLng::from_radians(0.852850182, 0.0409980285)?; # Ok::<(), h3o::error::InvalidLatLng>(()) ``` -------------------------------- ### Pre-allocating Memory for H3o Grid Operations Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/module_functions.md Use `max_grid_disk_size` and `max_grid_ring_size` to pre-allocate `Vec` capacity for grid disk and ring operations. Note that actual returned cell counts may be less than the pre-allocated capacity. ```rust // Pre-allocate for grid disk let k = 5; let mut cells = Vec::with_capacity(h3o::max_grid_disk_size(k) as usize); // Pre-allocate for grid ring let ring_cells = Vec::with_capacity(h3o::max_grid_ring_size(k) as usize); // The actual operations may return fewer cells let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let disk: Vec<_> = cell.grid_disk(k); assert!(disk.len() as u64 <= h3o::max_grid_disk_size(k)); ``` -------------------------------- ### Get Average Hexagon Area in Square Meters Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Calculates the average area of a hexagon at the given resolution in square meters. ```rust pub const fn area_m2(self) -> f64 ``` -------------------------------- ### Get Average Hexagon Area in Square Kilometers Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Calculates the average area of a hexagon at the given resolution in square kilometers. ```rust pub const fn area_km2(self) -> f64 ``` -------------------------------- ### Create Empty Boundary (Testing) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/boundary.md Creates an empty Boundary instance. This is primarily a testing utility and not intended for general use. Boundaries are typically obtained via CellIndex::boundary(). ```rust let mut boundary = h3o::Boundary::new(); ``` -------------------------------- ### Create LatLng from Degrees Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Constructs a LatLng coordinate from latitude and longitude values in degrees. Returns an error if the input values are non-finite. ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lat(), 48.864716); assert_eq!(coord.lng(), 2.349014); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` -------------------------------- ### Get Destination Cell of DirectedEdgeIndex Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/directed_edge_index.md Returns the destination cell of this directed edge. This cell must be adjacent to the origin cell. ```rust pub fn destination(self) -> CellIndex ``` ```rust let edge = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?; let end = edge.destination(); ``` -------------------------------- ### Get CellIndex Boundary Vertices Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Retrieve the geographic boundary of a CellIndex as a list of vertices. The number of vertices can vary for pentagons and hexagons. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let boundary = cell.boundary(); for vertex in boundary.iter() { println!("Vertex: {}", vertex); } ``` -------------------------------- ### Get Direction at Specific Resolution Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Obtain the direction from a parent cell to this cell at a specified resolution. This is useful for understanding the hierarchical relationship. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; assert_eq!(cell.direction_at(h3o::Resolution::Five), Some(h3o::Direction::K)); ``` -------------------------------- ### Displaying and Accessing Error Sources in Rust Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/errors.md Demonstrates how to handle errors that implement std::error::Error. Use this pattern to display user-friendly error messages and inspect the chain of underlying causes. ```rust match operation() { Ok(result) => println!("{:?}", result), Err(e) => { eprintln!("Error: {}", e); // Display trait eprintln!("Source: {:?}", e.source()); // Source chain } } ``` -------------------------------- ### Create Cell from Base Cell Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/base_cell.md Demonstrates how to create a higher resolution H3 cell index from a base cell and a direction. ```rust let base = h3o::BaseCell::try_from(42)?; // Create a cell at this base with a specific direction let cell = h3o::CellIndex::from_raw_parts( base, &[h3o::Direction::I] )?; # Ok::<(), Box>(()) ``` -------------------------------- ### Get Coordinate Count with geo-traits Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/boundary.md Retrieves the number of coordinates in a Boundary using the geo_traits::LineStringTrait. This requires the 'geo' feature to be enabled. ```rust #[cfg(feature = "geo")] { use geo_traits::LineStringTrait; let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let boundary = cell.boundary(); let num_coords = boundary.num_coords(); } ``` -------------------------------- ### Default H3o Dependency Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/configuration.md Enables standard library support and core functionality for H3o. This is the default configuration. ```toml [dependencies] h3o = "0.11" # Enables: std ``` -------------------------------- ### Get Next Coarser Resolution Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Returns the next coarser resolution. Returns `None` if the current resolution is already the minimum (0). ```rust pub fn pred(self) -> Option ``` -------------------------------- ### Serialize/Deserialize H3 CellIndex (serde feature) Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/INDEX.md Demonstrates serializing an H3 `CellIndex` to a JSON string and deserializing a JSON string back into a `CellIndex`. This requires the `serde` feature to be enabled. ```rust #[cfg(feature = "serde")] { use h3o::CellIndex; let cell = CellIndex::try_from(0x8a1fb46622dffff)?; // To JSON let json = serde_json::to_string(&cell)?; // From JSON let restored: CellIndex = serde_json::from_str(&json)?; } ``` -------------------------------- ### first Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Returns the first (smallest) cell at a specified resolution. Requires a Resolution parameter. ```APIDOC ## first ### Description Returns the first (smallest) cell at a given resolution. ### Method This is a static method on the `CellIndex` type. ### Parameters #### Path Parameters - **resolution** (`Resolution`) - Yes - Target resolution ### Returns - **CellIndex** - First cell at that resolution. ### Example ```rust let first = h3o::CellIndex::first(h3o::Resolution::Five); ``` ``` -------------------------------- ### Get Last Cell by Resolution Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Returns the last (largest) cell at a specified resolution. This method requires a `Resolution` enum value as input. ```rust pub fn last(resolution: Resolution) -> Self ``` ```rust let last = h3o::CellIndex::last(h3o::Resolution::Five); ``` -------------------------------- ### Get Grid Path Cells Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Returns an iterator of cells forming a path between two cells. This method can return an error if the cells are incomparable. ```rust pub fn grid_path_cells( self, to: Self, ) -> Result ``` ```rust let start = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; let end = h3o::CellIndex::try_from(0x8a1fb466222ffff)?; for cell in start.grid_path_cells(end)? { println!("Path: {}", cell); } ``` -------------------------------- ### Create LatLng from Geo Crate Coordinate Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Constructs a LatLng coordinate from a geo crate coordinate type, which expects values in degrees. Requires the 'geo' feature to be enabled. ```rust let coord = h3o::LatLng::from_coord(&(2.349014, 48.864716))?; ``` -------------------------------- ### LatLng::new Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Creates a new LatLng coordinate from latitude and longitude in degrees. It returns a Result, which will be Err if the provided values are non-finite. ```APIDOC ## LatLng::new ### Description Creates a new LatLng coordinate from latitude and longitude in degrees. It returns a Result, which will be Err if the provided values are non-finite. ### Parameters #### Path Parameters - **lat** (f64) - Required - Latitude in degrees (-90 to 90) - **lng** (f64) - Required - Longitude in degrees (-180 to 180) ### Response #### Success Response (Result) - Returns a valid LatLng coordinate if the input is valid. #### Errors - Returns `InvalidLatLng` if either component is NaN, infinite, or otherwise non-finite. ### Example ```rust let coord = h3o::LatLng::new(48.864716, 2.349014)?; assert_eq!(coord.lat(), 48.864716); assert_eq!(coord.lng(), 2.349014); # Ok::<(), h3o::error::InvalidLatLng>(()) ``` ``` -------------------------------- ### Get Maximum Face Count for a Cell Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Returns the maximum number of faces a cell can intersect. This is typically 2 for hexagons and 5 for pentagons. ```rust pub fn max_face_count(self) -> usize ``` ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; assert_eq!(cell.max_face_count(), 2); ``` -------------------------------- ### Get CellIndex Base Cell Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/cell_index.md Retrieve the base cell of a CellIndex. The base cell is one of the 122 unique cells at resolution 0. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; assert_eq!(cell.base_cell(), h3o::BaseCell::try_from(15)?); ``` -------------------------------- ### Get Average Hexagon Area in Square Radians Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Calculates the average area of a hexagon at the given resolution in square radians. Excludes pentagons. ```rust pub const fn area_rads2(self) -> f64 ``` -------------------------------- ### Convert BaseCell to u8 and usize Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/base_cell.md Illustrates converting a BaseCell into its underlying u8 or usize integer representation. ```rust impl From for u8 impl From for usize ``` ```rust let base = h3o::BaseCell::try_from(42)?; let as_u8: u8 = base.into(); assert_eq!(as_u8, 42); let as_usize: usize = base.into(); assert_eq!(as_usize, 42); # Ok::<(), h3o::error::InvalidBaseCell>(()) ``` -------------------------------- ### Convert between LatLng and geo::Coord Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/latlng.md Use `TryFrom` and `From` to convert between H3's LatLng struct and the geo crate's Coord struct when the 'geo' feature is enabled. ```rust let geo_coord = geo::Coord { x: 2.349014, y: 48.864716 }; let h3_coord = h3o::LatLng::try_from(geo_coord)?; let back = geo::Coord::from(h3_coord); ``` -------------------------------- ### Get Vertex Coordinates from CellIndex Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/vertex_index.md Iterates through all vertices of a given CellIndex and converts each vertex to its geographic coordinates. This is useful for drawing cell boundaries. ```rust let cell = h3o::CellIndex::try_from(0x8a1fb46622dffff)?; // Get vertices of this cell for vertex_index in cell.vertexes() { let coord = h3o::LatLng::from(vertex_index); println!("Vertex: {}", coord); } ``` -------------------------------- ### pentagons Source: https://github.com/hydroniumlabs/h3o/blob/master/_autodocs/api-reference/resolution.md Generate an iterator for all pentagon cells at a given resolution. ```APIDOC ## pentagons ### Description Generate all pentagons at this resolution. ### Method This is a method on the Resolution enum. ### Parameters None ### Returns - **impl Iterator** - Iterator yielding 12 pentagon cells. ### Request Example ```rust let pentagons: Vec<_> = h3o::Resolution::Two.pentagons().collect(); assert_eq!(pentagons.len(), 12); ``` ```