Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- gridDisk :: H3Index -> Int -> Either H3ErrorCodes [H3Index]
- gridDiskUnsafe :: H3Index -> Int -> Either H3ErrorCodes [H3Index]
- gridDiskDistances :: H3Index -> Int -> Either H3ErrorCodes ([H3Index], [Int])
- gridDiskDistancesSafe :: H3Index -> Int -> Either H3ErrorCodes ([H3Index], [Int])
- gridDiskDistancesUnsafe :: H3Index -> Int -> Either H3ErrorCodes ([H3Index], [Int])
- gridRingUnsafe :: H3Index -> Int -> Either H3ErrorCodes [H3Index]
- gridPathCells :: H3Index -> H3Index -> Either H3ErrorCodes [H3Index]
- gridDistance :: H3Index -> H3Index -> Either H3ErrorCodes Int64
- cellToLocalIj :: H3Index -> H3Index -> Either H3ErrorCodes CoordIJ
- localIjToCell :: H3Index -> CoordIJ -> Either H3ErrorCodes H3Index
Documentation
:: 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.
:: 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 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 #
gridDiskDistancesSafe produces indexes within k
distance of the origin
index.
gridDiskDistancesUnsafe Source #
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.
:: 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.
:: 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.
:: 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.
:: 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.
:: 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.