Module: H3::Inspection
Overview
Index inspection functions.
Instance Method Summary collapse
-
#base_cell(h3_index) ⇒ Integer
Derives the base cell number of the given H3 index.
-
#faces(h3_index) ⇒ Array<Integer>
Find all icosahedron faces intersected by a given H3 index.
-
#from_string(h3_string) ⇒ Integer
Derives the H3 index for a given hexadecimal string representation.
-
#h3_base_cell(h3_index) ⇒ Object
deprecated
Deprecated.
Please use #base_cell instead.
-
#h3_faces(h3_index) ⇒ Object
deprecated
Deprecated.
Please use #faces instead.
-
#h3_pentagon?(h3_index) ⇒ Boolean
deprecated
Deprecated.
Please use #pentagon? instead.
-
#h3_res_class_3?(h3_index) ⇒ Boolean
deprecated
Deprecated.
Please use #class_3_resolution? instead.
-
#h3_resolution(h3_index) ⇒ Object
deprecated
Deprecated.
Please use #resolution instead.
-
#h3_to_string(h3_index) ⇒ Object
deprecated
Deprecated.
Please use #to_string instead.
-
#h3_valid?(h3_index) ⇒ Boolean
deprecated
Deprecated.
Please use #valid? instead.
-
#max_face_count(h3_index) ⇒ Integer
Returns the maximum number of icosahedron faces the given H3 index may intersect.
-
#resolution(h3_index) ⇒ Integer
Derive the resolution of a given H3 index.
-
#string_to_h3(string) ⇒ Object
deprecated
Deprecated.
Please use #from_string instead.
-
#to_string(h3_index) ⇒ String
Derives the hexadecimal string representation for a given H3 index.
Methods included from Bindings::Base
Instance Method Details
#base_cell(h3_index) ⇒ Integer
Derives the base cell number of the given H3 index
41 |
# File 'lib/h3/inspection.rb', line 41 attach_function :base_cell, :h3GetBaseCell, %i[h3_index], :int |
#faces(h3_index) ⇒ Array<Integer>
Find all icosahedron faces intersected by a given H3 index.
177 178 179 180 181 182 183 |
# File 'lib/h3/inspection.rb', line 177 def faces(h3_index) max_faces = max_face_count(h3_index) out = FFI::MemoryPointer.new(:int, max_faces) Bindings::Private.h3_faces(h3_index, out) # The C function returns a sparse array whose holes are represented by -1. out.read_array_of_int(max_faces).reject(&:negative?).sort end |
#from_string(h3_string) ⇒ Integer
Derives the H3 index for a given hexadecimal string representation.
60 |
# File 'lib/h3/inspection.rb', line 60 attach_function :from_string, :stringToH3, %i[string], :h3_index |
#h3_base_cell(h3_index) ⇒ Object
Please use #base_cell instead.
44 45 46 |
# File 'lib/h3/inspection.rb', line 44 def h3_base_cell(h3_index) base_cell(h3_index) end |
#h3_faces(h3_index) ⇒ Object
Please use #faces instead.
186 187 188 |
# File 'lib/h3/inspection.rb', line 186 def h3_faces(h3_index) faces(h3_index) end |
#h3_pentagon?(h3_index) ⇒ Boolean
Please use #pentagon? instead.
84 85 86 |
# File 'lib/h3/inspection.rb', line 84 def h3_pentagon?(h3_index) pentagon?(h3_index) end |
#h3_res_class_3?(h3_index) ⇒ Boolean
Please use #class_3_resolution? instead.
106 107 108 |
# File 'lib/h3/inspection.rb', line 106 def h3_res_class_3?(h3_index) class_3_resolution?(h3_index) end |
#h3_resolution(h3_index) ⇒ Object
Please use #resolution instead.
25 26 27 |
# File 'lib/h3/inspection.rb', line 25 def h3_resolution(h3_index) resolution(h3_index) end |
#h3_to_string(h3_index) ⇒ Object
Please use #to_string instead.
148 149 150 |
# File 'lib/h3/inspection.rb', line 148 def h3_to_string(h3_index) to_string(h3_index) end |
#h3_valid?(h3_index) ⇒ Boolean
Please use #valid? instead.
127 128 129 |
# File 'lib/h3/inspection.rb', line 127 def h3_valid?(h3_index) valid?(h3_index) end |
#max_face_count(h3_index) ⇒ Integer
Returns the maximum number of icosahedron faces the given H3 index may intersect.
164 |
# File 'lib/h3/inspection.rb', line 164 attach_function :max_face_count, :maxFaceCount, %i[h3_index], :int |
#resolution(h3_index) ⇒ Integer
Derive the resolution of a given H3 index
22 |
# File 'lib/h3/inspection.rb', line 22 attach_function :resolution, :h3GetResolution, %i[h3_index], Resolution |
#string_to_h3(string) ⇒ Object
Please use #from_string instead.
63 64 65 |
# File 'lib/h3/inspection.rb', line 63 def string_to_h3(string) from_string(string) end |
#to_string(h3_index) ⇒ String
Derives the hexadecimal string representation for a given H3 index.
141 142 143 144 145 |
# File 'lib/h3/inspection.rb', line 141 def to_string(h3_index) h3_str = FFI::MemoryPointer.new(:char, H3_TO_STR_BUF_SIZE) Bindings::Private.h3_to_string(h3_index, h3_str, H3_TO_STR_BUF_SIZE) h3_str.read_string end |