hgeos-0.1.6.0: Simple Haskell bindings to GEOS C API

Copyright(C) Richard Cook, 2016
LicenseMIT
Maintainerrcook@rcook.org
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Geolocation.GEOS

Description

A high-level API for interoperating with GEOS C API which includes automatic management of lifetimes of objects such as readers, writers and geometries.

For the low-level FFI bindings, see Data.Geolocation.GEOS.Imports.

For the monad transformer wrappers, see Data.Geolocation.GEOS.Trans.

View sample 1

View sample 2

Synopsis

Documentation

data Context Source

Represents a GEOS context

data CoordinateSequence Source

References a GEOS coordinate sequence

data Geometry Source

References a GEOS geometry

data Reader Source

References a WKT reader

data Writer Source

References a WKT writer

area :: Geometry -> IO (Maybe Double) Source

Returns area of a Geometry instance

createLinearRing :: CoordinateSequence -> IO (Maybe Geometry) Source

Returns a linear ring Geometry instance from the given coordinate sequence

envelope :: Geometry -> IO (Maybe Geometry) Source

Returns a Geometry instance representing the envelope of the supplied Geometry

geomTypeId :: Geometry -> IO (Maybe GeometryType) Source

Returns type of a Geometry instance

getErrorMessage :: IO String Source

Returns message in case of error

getExteriorRing :: Geometry -> IO (Maybe Geometry) Source

Returns a Geometry instance representing the exterior ring of the supplied Geometry

getGeometry :: Geometry -> Int -> IO (Maybe Geometry) Source

Returns child Geometry at given index

getNumGeometries :: Geometry -> IO (Maybe Int) Source

Gets the number of geometries in a Geometry instance

getSize :: CoordinateSequence -> IO (Maybe Word) Source

Gets the size from a coordinate sequence

getX :: CoordinateSequence -> Word -> IO (Maybe Double) Source

Gets an "x" ordinate value from a coordinate sequence

getY :: CoordinateSequence -> Word -> IO (Maybe Double) Source

Gets a "y" ordinate value from a coordinate sequence

getZ :: CoordinateSequence -> Word -> IO (Maybe Double) Source

Gets a "z" ordinate value from a coordinate sequence

intersection :: Geometry -> Geometry -> IO (Maybe Geometry) Source

Returns a Geometry instance representing the intersection of the two supplied Geometry instances:

isEmpty :: Geometry -> IO (Maybe Bool) Source

Returns value indicating if specified Geometry instance is empty

mkReader :: Context -> IO (Maybe Reader) Source

Creates a reader used to deserialize Geometry instances from WKT-format text:

mkWriter :: Context -> IO (Maybe Writer) Source

Creates a writer used to serialize Geometry instances to WKT-format text:

readGeometry :: Reader -> String -> IO (Maybe Geometry) Source

Deserializes a Geometry instance from the given String using the supplied Reader:

setX :: CoordinateSequence -> Word -> Double -> IO (Maybe ()) Source

Sets an "x" ordinate value within a coordinate sequence

setY :: CoordinateSequence -> Word -> Double -> IO (Maybe ()) Source

Sets an "y" ordinate value within a coordinate sequence

setZ :: CoordinateSequence -> Word -> Double -> IO (Maybe ()) Source

Sets an "z" ordinate value within a coordinate sequence

version :: IO String Source

Reports version of GEOS API

withGEOS :: (Context -> IO a) -> IO a Source

Creates a GEOS context, passes it to a block and releases the context and all associated objects such as readers, writers and geometries at the end:

   withGEOS $ ctx -> do

       -- Use context

       return ()

writeGeometry :: Writer -> Geometry -> IO (Maybe String) Source

Serializes a Geometry instance to a String using the supplied Writer: