module H3.Regions
( polygonToCells
, cellsToLinkedMultiPolygon
) where
import Data.Word (Word32)
import H3.Internal.H3Api
( H3ErrorCodes
, H3Index
, GeoPolygon
, hsCellsToLinkedMultiPolygon
)
import H3.Internal.FFI
( hsPolygonToCells
)
import H3.Internal.Utils (toEither)
polygonToCells :: GeoPolygon
-> Int
-> Word32
-> Either H3ErrorCodes [H3Index]
polygonToCells :: GeoPolygon -> Int -> Word32 -> Either H3ErrorCodes [H3Index]
polygonToCells GeoPolygon
poly Int
res = (Word32, [H3Index]) -> Either H3ErrorCodes [H3Index]
forall a. (Word32, a) -> Either H3ErrorCodes a
toEither ((Word32, [H3Index]) -> Either H3ErrorCodes [H3Index])
-> (Word32 -> (Word32, [H3Index]))
-> Word32
-> Either H3ErrorCodes [H3Index]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GeoPolygon -> Int -> Word32 -> (Word32, [H3Index])
hsPolygonToCells GeoPolygon
poly Int
res
cellsToLinkedMultiPolygon :: [H3Index] -> Either H3ErrorCodes [GeoPolygon]
cellsToLinkedMultiPolygon :: [H3Index] -> Either H3ErrorCodes [GeoPolygon]
cellsToLinkedMultiPolygon = (Word32, [GeoPolygon]) -> Either H3ErrorCodes [GeoPolygon]
forall a. (Word32, a) -> Either H3ErrorCodes a
toEither ((Word32, [GeoPolygon]) -> Either H3ErrorCodes [GeoPolygon])
-> ([H3Index] -> (Word32, [GeoPolygon]))
-> [H3Index]
-> Either H3ErrorCodes [GeoPolygon]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [H3Index] -> (Word32, [GeoPolygon])
hsCellsToLinkedMultiPolygon