Module: H3::Miscellaneous
Overview
Miscellaneous functions.
Instance Method Summary collapse
-
#base_cell_count ⇒ Integer
Returns the number of resolution 0 hexagons (base cells).
-
#base_cells ⇒ Array<Integer>
Returns all resolution 0 hexagons (base cells).
-
#degs_to_rads(degs) ⇒ Float
Convert a number expressed in degrees to its equivalent in radians.
-
#edge_length_km(resolution) ⇒ Float
Derive the length of a hexagon edge in kilometres at the given resolution.
-
#edge_length_m(resolution) ⇒ Float
Derive the length of a hexagon edge in metres at the given resolution.
-
#hex_area_km2(resolution) ⇒ Float
Average hexagon area in square kilometres at the given resolution.
-
#hex_area_m2(resolution) ⇒ Float
Average hexagon area in square metres at the given resolution.
-
#hexagon_count(resolution) ⇒ Integer
Number of unique H3 indexes at the given resolution.
-
#pentagon_count ⇒ Integer
Number of pentagon H3 indexes per resolution.
-
#pentagons(resolution) ⇒ Array<Integer>
Returns all pentagon indexes at the given resolution.
-
#rads_to_degs(rads) ⇒ Float
Convert a number expressed in radians to its equivalent in degrees.
Methods included from Bindings::Base
attach_predicate_function, extended
Instance Method Details
#base_cell_count ⇒ Integer
Returns the number of resolution 0 hexagons (base cells).
108 |
# File 'lib/h3/miscellaneous.rb', line 108 attach_function :base_cell_count, :res0IndexCount, [], :int |
#base_cells ⇒ Array<Integer>
Returns all resolution 0 hexagons (base cells).
129 130 131 132 133 |
# File 'lib/h3/miscellaneous.rb', line 129 def base_cells out = H3Indexes.of_size(base_cell_count) Bindings::Private.res_0_indexes(out) out.read end |
#degs_to_rads(degs) ⇒ Float
Convert a number expressed in degrees to its equivalent in radians.
19 |
# File 'lib/h3/miscellaneous.rb', line 19 attach_function :degs_to_rads, :degsToRads, %i[double], :double |
#edge_length_km(resolution) ⇒ Float
Derive the length of a hexagon edge in kilometres at the given resolution.
32 |
# File 'lib/h3/miscellaneous.rb', line 32 attach_function :edge_length_km, :edgeLengthKm, [Resolution], :double |
#edge_length_m(resolution) ⇒ Float
Derive the length of a hexagon edge in metres at the given resolution.
45 |
# File 'lib/h3/miscellaneous.rb', line 45 attach_function :edge_length_m, :edgeLengthM, [Resolution], :double |
#hex_area_km2(resolution) ⇒ Float
Average hexagon area in square kilometres at the given resolution.
58 |
# File 'lib/h3/miscellaneous.rb', line 58 attach_function :hex_area_km2, :hexAreaKm2, [Resolution], :double |
#hex_area_m2(resolution) ⇒ Float
Average hexagon area in square metres at the given resolution.
71 |
# File 'lib/h3/miscellaneous.rb', line 71 attach_function :hex_area_m2, :hexAreaM2, [Resolution], :double |
#hexagon_count(resolution) ⇒ Integer
Number of unique H3 indexes at the given resolution.
84 |
# File 'lib/h3/miscellaneous.rb', line 84 attach_function :hexagon_count, :numHexagons, [Resolution], :ulong_long |
#pentagon_count ⇒ Integer
Number of pentagon H3 indexes per resolution. This is always 12, but provided as a convenience.
120 |
# File 'lib/h3/miscellaneous.rb', line 120 attach_function :pentagon_count, :pentagonIndexCount, [], :int |
#pentagons(resolution) ⇒ Array<Integer>
Returns all pentagon indexes at the given resolution.
142 143 144 145 146 |
# File 'lib/h3/miscellaneous.rb', line 142 def pentagons(resolution) out = H3Indexes.of_size(pentagon_count) Bindings::Private.get_pentagon_indexes(resolution, out) out.read end |
#rads_to_degs(rads) ⇒ Float
Convert a number expressed in radians to its equivalent in degrees.
97 |
# File 'lib/h3/miscellaneous.rb', line 97 attach_function :rads_to_degs, :radsToDegs, %i[double], :double |