h3-hs-0.2.0.0: A Haskell binding for H3
Safe HaskellSafe-Inferred
LanguageHaskell2010

H3.Traversal

Description

Grid traversal allows finding cells in the vicinity of an origin cell, and determining how to traverse the grid from one cell to another.

Synopsis

Documentation

gridDisk Source #

Arguments

:: H3Index

origin

-> Int

k

-> Either H3ErrorCodes [H3Index] 

gridDisk produces indices within k distance of the origin index. Elements of the output array may be left as zero, which can happen when crossing a pentagon.

gridDiskUnsafe Source #

Arguments

:: H3Index

origin

-> Int

k

-> Either H3ErrorCodes [H3Index] 

gridDiskUnsafe produces indexes within k distance of the origin index. The function returns an error code when one of the returned by this function is a pentagon or is in the pentagon distortion area. In this case, the output behavior of the out array is undefined.

gridDiskDistances Source #

Arguments

:: H3Index

origin

-> Int

k

-> Either H3ErrorCodes ([H3Index], [Int]) 

gridDiskDistances produces indices within k distance of the origin index. k-ring 0 is defined as the origin index, k-ring 1 is defined as k-ring 0 and all neighboring indices, and so on.

gridDiskDistancesSafe Source #

Arguments

:: H3Index

origin

-> Int

k

-> Either H3ErrorCodes ([H3Index], [Int]) 

gridDiskDistancesSafe produces indexes within k distance of the origin index.

gridDiskDistancesUnsafe Source #

Arguments

:: H3Index

origin

-> Int

k

-> Either H3ErrorCodes ([H3Index], [Int]) 

gridDiskDistancesUnsafe produces indexes within k distance of the origin index. Output behavior is undefined when one of the indexes returned by this function is a pentagon or is in the pentagon distortion area.

gridRingUnsafe Source #

Arguments

:: H3Index

origin

-> Int

k

-> Either H3ErrorCodes [H3Index] 

Produces the hollow hexagonal ring centered at origin with sides of length k. In this Haskell method, zeros have been removed from the resulting list of H3 indexes.

gridPathCells Source #

Arguments

:: H3Index

start

-> H3Index

end

-> Either H3ErrorCodes [H3Index] 

Given two H3 indexes, return the line of indexes between them (inclusive). This function may fail to find the line between two indexes, for example if they are very far apart. It may also fail when finding distances for indexes on opposite sides of a pentagon.

Notes:

  • The specific output of this function should not be considered stable across library versions. The only guarantees the library provides are that the line length will be consistent with the distance method and that every index in the line will be a neighbor of the preceding index.
  • Lines are drawn in grid space, and may not correspond exactly to either Cartesian lines or great arcs.

gridDistance Source #

Arguments

:: H3Index

origin

-> H3Index

destination

-> Either H3ErrorCodes Int64 

Provides the distance in grid cells between the two indexes. Returns an error if finding the distance failed. Finding the distance can fail because the two indexes are not comparable (different resolutions), too far apart, or are separated by pentagonal distortion. This is the same set of limitations as the local IJ coordinate space functions.

cellToLocalIj Source #

Arguments

:: H3Index

origin

-> H3Index

destination

-> Either H3ErrorCodes CoordIJ 

Produces local IJ coordinates for an H3 index anchored by an origin. The C API has an additional argument mode which is reserved for future expansion and must be set to 0. The method provided here automatically passes the value. This function's output is not guaranteed to be compatible across different versions of H3.

localIjToCell Source #

Arguments

:: H3Index

origin

-> CoordIJ

ij

-> Either H3ErrorCodes H3Index 

Produces an H3 index from local IJ coordinates anchored by an origin. The C API has an additional argument mode which is reserved for future expansion and must be set to 0, and the method defined here automatically passes the value. This function's output is not guaranteed to be compatible across different versions of H3.