Struct h3ron::H3Cell

source ·
#[repr(transparent)]
pub struct H3Cell(_);
Expand description

H3 Index representing a H3 Cell (hexagon)

Implementations§

Build a new Index from a Point.

Returns

If the built index is invalid, returns an Error.

Build a new Index from coordinates.

Returns

If the built index is invalid, returns an Error.

Checks if self is a parent of other

Checks if other is a parent of self

Checks if self is a parent of other

Retrieves the parent (or grandparent, etc) cell of the given cell

Retrieves all children of self at resolution child_resolution

Checks if the current index and other are neighbors.

grid_disk produces all cells within k distance of the origin cell.

k=0 is defined as the origin cell, k=1 is defined as k=0 + all neighboring cells, and so on.

Note

For repeated building of grid disks, there is also super::iter::GridDiskBuilder.

hollow hexagon ring at self

Retrieves indexes around self through K Rings.

Arguments
  • k_min - the minimum k ring distance
  • k_max - the maximum k ring distance
Returns

A Vec of (u32, Index) tuple is returned. The u32 value is the K Ring distance of the Index value.

Note

For repeated building of k-rings, there is also super::iter::GridDiskBuilder.

Retrieves the number of K Rings between self and other.

For distance in miles or kilometers use haversine algorithms.

determines if an H3 cell is a pentagon

returns the base cell “number” (0 to 121) of the provided H3 cell

Gets the directed edge from self to destination

Returns

If the built index is invalid, returns an Error. Use the unidirectional_edge_to_unchecked to avoid error.

Retrieves all directed H3 edges around self where self is the origin

For repeated creation of H3DirectedEdge around a H3Cell also see crate::iter::H3DirectedEdgesBuilder, which is more efficient.

get the average cell area at resolution in square meters.

use h3ron::H3Cell;

assert_eq!(15047, H3Cell::area_avg_m2(10).unwrap() as i32);

get the average cell area at resolution in square kilometers.

Retrieves the exact area of self in square meters

Retrieves the exact area of self in square kilometers

Retrieves the exact area of self in square radians

returns the center child of self at the specified resolution.

Produces an H3Cell for the given coordij coordinates anchored by origin_cell.

The coordinate space used by this function may have deleted regions or warping due to pentagonal distortion.

Failure may occur if the index is too far away from the origin or if the index is on the other side of a pentagon.

This function’s output is not guaranteed to be compatible across different versions of H3.

Produces CoordIj coordinates for this H3Cell instance anchored by an origin H3Cell origin_cell.

The coordinate space used by this function may have deleted regions or warping due to pentagonal distortion.

Failure may occur if the index is too far away from the origin or if the index is on the other side of a pentagon.

This function’s output is not guaranteed to be compatible across different versions of H3.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Deserialize this value from the given Serde deserializer. Read more

Parse a hex-representation of a H3Cell from a string.

With the parse feature enabled this function is also able to parse strings containing integers and a custom coordinate-based format in the form of "x,y,resolution".

Examples:

use h3ron::{H3Cell, Index};
use std::str::FromStr;

let index = H3Cell::from_str("89283080ddbffff").unwrap();

#[cfg(feature = "parse")]
{
    // parse from a string containing an integer
    let index = H3Cell::from_str("617700169518678015").unwrap();

    // parse from coordinates and resolution
    let index = H3Cell::from_str("23.3,12.3,6").unwrap();
}
The associated error which can be returned from parsing.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
Get the u64 H3 Index address
create an index from the given u64. Read more
Checks the validity of the index
Gets the index resolution (0-15)
Checks the validity of the index
Retrieves the direction of the current index Read more
Retrieves the direction of the current index Read more
Retrieves the direction of the current index relative to a parent at target_resolution
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Serialize this value into the given Serde serializer. Read more

the centroid coordinate of the h3 index

the polygon spanning the area of the index

Converts the given value to a String. Read more

convert to index including validation

The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Checks if this value is equivalent to the given key. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.