module

Miscellaneous

Inherits H3::Bindings::Base < H3::Bindings::Private < H3::Bindings::Types < H3::Bindings::Types

Instance methods

base_cell_count

@!method base_cell_count

Returns the number of resolution 0 hexagons (base cells).

@example Return the number of base cells H3.base_cell_count 122

@return [Integer] The number of resolution 0 hexagons (base cells).

Source
base_cells

Returns all resolution 0 hexagons (base cells).

@example Return all base cells. H3.base_cells [576495936675512319, 576531121047601151, ..., 580753245698260991]

@return [Array<Integer>] All resolution 0 hexagons (base cells).

Source
cell_area_km2(h3_index : UInt64) : Float64

@!method cell_area_km2(h3_index)

Exact area of a specific cell in square kilometres.

@param [Integer] h3_index A valid H3 index.

@example Get exact area in square kilometres. H3.cell_area_km2(612933930963697663) 0.1234

@return [Float] Exact area of the cell in square kilometres.

Source
cell_area_m2(h3_index : UInt64) : Float64

@!method cell_area_m2(h3_index)

Exact area of a specific cell in square metres.

@param [Integer] h3_index A valid H3 index.

@example Get exact area in square metres. H3.cell_area_m2(612933930963697663) 123400.0

@return [Float] Exact area of the cell in square metres.

Source
cell_area_rads2(h3_index : UInt64) : Float64

@!method cell_area_rads2(h3_index)

Exact area of a specific cell in square radians.

@param [Integer] h3_index A valid H3 index.

@example Get exact area in square radians. H3.cell_area_rads2(612933930963697663) 1.234e-10

@return [Float] Exact area of the cell in square radians.

Source
degs_to_rads(degrees : Float64) : Float64

@!method degs_to_rads(degs)

Convert a number expressed in degrees to its equivalent in radians.

@param [Float] degs Value expressed in degrees.

@example Convert degrees value to radians. H3.degs_to_rads(19.61922082086965) 0.34242

@return [Float] Value expressed in radians.

Source
describe_h3_error(err : UInt32) : String

@!method describe_h3_error(err)

Provide a human-readable description of an H3Error error code.

@param [Integer] err H3 error code.

@example Describe error code 1 H3.describe_h3_error(1) "The operation failed but a more specific error is not available"

@return [String] Human-readable error description.

Source
edge_length_km(resolution : Int32) : Float64

@!method edge_length_km(resolution)

Derive the length of a hexagon edge in kilometres at the given resolution.

@param [Integer] resolution Resolution.

@example Derive length of edge in kilometres H3.edge_length_km(3) 59.81085794

@return [Float] Length of edge in kilometres

Source
edge_length_m(resolution : Int32) : Float64

@!method edge_length_m(resolution)

Derive the length of a hexagon edge in metres at the given resolution.

@param [Integer] resolution Resolution.

@example Derive length of edge in metres H3.edge_length_m(6) 3229.482772

@return [Float] Length of edge in metres

Source
get_index_digit(h3_index : UInt64, resolution : Int32) : Int32

@!method get_index_digit(h3_index, resolution)

Returns the index digit at the given resolution. Resolution starts at 1 and goes up to 15. The digit represents the direction from the parent cell at that resolution.

@param [Integer] h3_index A valid H3 index. @param [Integer] resolution Resolution level (1-15).

@example Get the index digit at resolution 8 H3.get_index_digit(612933930963697663, 8) 0

@return [Integer] The index digit at the given resolution.

Source
great_circle_distance_km(lat1 : Float64, lng1 : Float64, lat2 : Float64, lng2 : Float64) : Float64

@!method great_circle_distance_km(lat1, lng1, lat2, lng2)

Compute the great circle distance in kilometres between two points. Coordinates are provided in degrees and converted to radians internally.

@param [Float] lat1 Latitude of the first point in degrees. @param [Float] lng1 Longitude of the first point in degrees. @param [Float] lat2 Latitude of the second point in degrees. @param [Float] lng2 Longitude of the second point in degrees.

@example Compute great circle distance in kilometres. H3.great_circle_distance_km(0.0, 0.0, 1.0, 0.0) 111.195

@return [Float] Great circle distance in kilometres.

Source
great_circle_distance_m(lat1 : Float64, lng1 : Float64, lat2 : Float64, lng2 : Float64) : Float64

@!method great_circle_distance_m(lat1, lng1, lat2, lng2)

Compute the great circle distance in metres between two points. Coordinates are provided in degrees and converted to radians internally.

@param [Float] lat1 Latitude of the first point in degrees. @param [Float] lng1 Longitude of the first point in degrees. @param [Float] lat2 Latitude of the second point in degrees. @param [Float] lng2 Longitude of the second point in degrees.

@example Compute great circle distance in metres. H3.great_circle_distance_m(0.0, 0.0, 1.0, 0.0) 111195.0

@return [Float] Great circle distance in metres.

Source
great_circle_distance_rads(lat1 : Float64, lng1 : Float64, lat2 : Float64, lng2 : Float64) : Float64

@!method great_circle_distance_rads(lat1, lng1, lat2, lng2)

Compute the great circle distance in radians between two points. Coordinates are provided in degrees and converted to radians internally.

@param [Float] lat1 Latitude of the first point in degrees. @param [Float] lng1 Longitude of the first point in degrees. @param [Float] lat2 Latitude of the second point in degrees. @param [Float] lng2 Longitude of the second point in degrees.

@example Compute great circle distance in radians. H3.great_circle_distance_rads(0.0, 0.0, 1.0, 0.0) 0.01745

@return [Float] Great circle distance in radians.

Source
hex_area_km2(resolution : Int32) : Float64

@!method hex_area_km2(resolution)

Average hexagon area in square kilometres at the given resolution.

@param [Integer] resolution Resolution.

@example Find the square kilometre size at resolution 5 H3.hex_area_km2(5) 252.9033645

@return [Float] Average hexagon area in square kilometres.

Source
hex_area_m2(resolution : Int32) : Float64

@!method hex_area_m2(resolution)

Average hexagon area in square metres at the given resolution.

@param [Integer] resolution Resolution.

@example Find the square metre size at resolution 10 H3.hex_area_m2(10) 15047.5

@return [Float] Average hexagon area in square metres.

Source
hexagon_count(resolution : Int32) : Int64

@!method hexagon_count(resolution)

Number of unique H3 indexes at the given resolution.

@param [Integer] resolution Resolution.

@example Find number of hexagons at resolution 6 H3.hexagon_count(6) 14117882

@return [Integer] Number of unique hexagons

Source
pentagon_count

@!method pentagon_count

Number of pentagon H3 indexes per resolution. This is always 12, but provided as a convenience.

@example Return the number of pentagons H3.pentagon_count 12

@return [Integer] The number of pentagons per resolution.

Source
pentagons(resolution) : Array(UInt64)

Returns all pentagon indexes at the given resolution.

@example Return all pentagons at resolution 4. H3.pentagons(4) [594615896891195391, 594967740612083711, ..., 598591730937233407]

@return [Array<Integer>] All pentagon indexes at the given resolution.

Source
rads_to_degs(rads : Float64) : Float64

@!method rads_to_degs(rads)

Convert a number expressed in radians to its equivalent in degrees.

@param [Float] rads Value expressed in radians.

@example Convert radians value to degrees. H3.rads_to_degs(0.34242) 19.61922082086965

@return [Float] Value expressed in degrees.

Source
valid_index?(h3_index : UInt64) : Bool

@!method valid_index?(h3_index)

Determine whether the given H3 index is valid. Unlike valid? (isValidCell), this validates any H3 index type including cells, directed edges, and vertices.

@param [Integer] h3_index A H3 index.

@example Check if H3 index is valid H3.valid_index?(612933930963697663) true

@return [Boolean] True if the H3 index is valid.

Source