Vertex
Inherits Miscellaneous < H3::Bindings::Base < H3::Bindings::Private < H3::Bindings::Types < H3::Bindings::Types < H3::Bindings::Base < H3::Bindings::Private < H3::Bindings::Types < H3::Bindings::Types
Instance methods
Converts an H3 cell index to local IJ coordinates relative to an origin cell.
The mode parameter controls the coordinate system behavior. Use 0 for default.
@param [Integer] origin Origin H3 cell index. @param [Integer] h3 Target H3 cell index. @param [Integer] mode Coordinate system mode (default 0).
@example Convert cell to local IJ coordinates. H3.cell_to_local_ij(origin, target) {i, j}
@raise [Exception] If the conversion fails (e.g., cells are too far apart or a pentagon is encountered).
@return [Tuple(Int32, Int32)] IJ coordinates as {i, j}.
Returns the vertex index for the given cell and vertex number.
@param [Integer] origin A valid H3 cell index. @param [Integer] vertex_num The vertex number (0-5 for hexagons, 0-4 for pentagons).
@example Get vertex 0 of a cell. H3.cell_to_vertex(612933930963697663, 0)
@raise [Exception] If the vertex number is invalid for the cell.
@return [Integer] H3 vertex index.
Returns all vertex indexes for the given cell.
Hexagonal cells have 6 vertices. Pentagonal cells have 5 vertices. The output array is allocated with 6 elements; for pentagons, one element will be zero and is filtered out.
@param [Integer] origin A valid H3 cell index.
@example Get all vertices of a cell. H3.cell_to_vertexes(612933930963697663)
@raise [Exception] If the operation fails.
@return [Array<Integer>] Array of H3 vertex indexes.
Converts local IJ coordinates to an H3 cell index relative to an origin cell.
The mode parameter controls the coordinate system behavior. Use 0 for default.
@param [Integer] origin Origin H3 cell index. @param [Tuple(Int32, Int32)] ij IJ coordinates as {i, j}. @param [Integer] mode Coordinate system mode (default 0).
@example Convert local IJ coordinates back to a cell. H3.local_ij_to_cell(origin, {1, 2})
@raise [Exception] If the conversion fails.
@return [Integer] H3 cell index.
Determines whether the given H3 index is a valid vertex.
@param [Integer] vertex A H3 index.
@example Check if an index is a valid vertex. H3.valid_vertex?(vertex_index) true
@return [Boolean] True if the H3 index is a valid vertex.
Returns the latitude and longitude of the given vertex in degrees.
@param [Integer] vertex A valid H3 vertex index.
@example Get the coordinates of a vertex. H3.vertex_to_lat_lng(vertex_index) {lat, lng}
@raise [Exception] If the vertex is invalid.
@return [Tuple(Float64, Float64)] Latitude and longitude in degrees.