Module: H3::Miscellaneous

Extended by:
Bindings::Base
Included in:
H3
Defined in:
lib/h3/miscellaneous.rb

Overview

Miscellaneous functions.

Instance Method Summary collapse

Methods included from Bindings::Base

extended

Instance Method Details

#degs_to_rads(degs) ⇒ Float

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

Examples:

Convert degrees value to radians.

H3.degs_to_rads(19.61922082086965)
0.34242

Parameters:

  • degs (Float)

    Value expressed in degrees.

Returns:

  • (Float)

    Value expressed in radians.



19
# File 'lib/h3/miscellaneous.rb', line 19

attach_function :degs_to_rads, :degsToRads, [ :double ], :double

#edge_length_km(resolution) ⇒ Float

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

Examples:

Derive length of edge in kilometres

H3.edge_length_km(3)
59.81085794

Parameters:

  • resolution (Integer)

    Resolution.

Returns:

  • (Float)

    Length of edge in kilometres



32
# File 'lib/h3/miscellaneous.rb', line 32

attach_function :edge_length_km, :edgeLengthKm, [ :int ], :double

#edge_length_m(resolution) ⇒ Float

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

Examples:

Derive length of edge in metres

H3.edge_length_m(6)
3229.482772

Parameters:

  • resolution (Integer)

    Resolution.

Returns:

  • (Float)

    Length of edge in metres



45
# File 'lib/h3/miscellaneous.rb', line 45

attach_function :edge_length_m, :edgeLengthM, [ :int ], :double

#hex_area_km2(resolution) ⇒ Float

Average hexagon area in square kilometres at the given resolution.

Examples:

Find the square kilometre size at resolution 5

H3.hex_area_km2(5)
252.9033645

Parameters:

  • resolution (Integer)

    Resolution.

Returns:

  • (Float)

    Average hexagon area in square kilometres.



58
# File 'lib/h3/miscellaneous.rb', line 58

attach_function :hex_area_km2, :hexAreaKm2, [ :int ], :double

#hex_area_m2(resolution) ⇒ Float

Average hexagon area in square metres at the given resolution.

Examples:

Find the square metre size at resolution 10

H3.hex_area_m2(10)
15047.5

Parameters:

  • resolution (Integer)

    Resolution.

Returns:

  • (Float)

    Average hexagon area in square metres.



71
# File 'lib/h3/miscellaneous.rb', line 71

attach_function :hex_area_m2, :hexAreaM2, [ :int ], :double

#num_hexagons(resolution) ⇒ Integer

Number of unique H3 indexes at the given resolution.

Examples:

Find number of hexagons at resolution 6

H3.num_hexagons(6)
14117882

Parameters:

  • resolution (Integer)

    Resolution.

Returns:

  • (Integer)

    Number of unique hexagons



84
# File 'lib/h3/miscellaneous.rb', line 84

attach_function :num_hexagons, :numHexagons, [ :int ], :ulong_long

#rads_to_degs(rads) ⇒ Float

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

Examples:

Convert radians value to degrees.

H3.rads_to_degs(0.34242)
19.61922082086965

Parameters:

  • rads (Float)

    Value expressed in radians.

Returns:

  • (Float)

    Value expressed in degrees.



97
# File 'lib/h3/miscellaneous.rb', line 97

attach_function :rads_to_degs, :radsToDegs, [ :double ], :double