hgeos-0.1.8.0: Simple Haskell bindings to GEOS C API

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

Data.Geolocation.GEOS

Description

A high-level API for interoperating with Geometry Engine Open Source 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 GEOSError Source

Encapsulates an exception thrown by GEOS library

data Geometry Source

References a GEOS geometry

data Reader Source

References a WKT reader

data Writer Source

References a WKT writer

area :: Geometry -> IO Double Source

Returns area of a Geometry instance

createEmptyPolygon :: Context -> IO Geometry Source

Returns an empty polygon Geometry instance

createLinearRing :: CoordinateSequence -> IO Geometry Source

Returns a linear ring Geometry instance from the given coordinate sequence

createPolygon :: Geometry -> [Geometry] -> IO Geometry Source

Returns a polygon Geometry instance from the given shell and optional array of holes

envelope :: Geometry -> IO Geometry Source

Returns a Geometry instance representing the envelope of the supplied Geometry

geomTypeId :: Geometry -> IO GeometryType Source

Returns type of a Geometry instance

getErrorMessage :: IO String Source

Returns message in case of error

getExteriorRing :: Geometry -> IO Geometry Source

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

getGeometry :: Geometry -> Int -> IO Geometry Source

Returns child Geometry at given index

getNumGeometries :: Geometry -> IO Int Source

Gets the number of geometries in a Geometry instance

getOrdinate :: CoordinateSequence -> Word -> Word -> IO Double Source

Gets an ordinate value from a coordinate sequence

getSize :: CoordinateSequence -> IO Word Source

Gets the size from a coordinate sequence

getX :: CoordinateSequence -> Word -> IO Double Source

Gets an x-ordinate value from a coordinate sequence

getY :: CoordinateSequence -> Word -> IO Double Source

Gets a y-ordinate value from a coordinate sequence

getZ :: CoordinateSequence -> Word -> IO Double Source

Gets a z-ordinate value from a coordinate sequence

intersection :: Geometry -> Geometry -> IO Geometry Source

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

isEmpty :: Geometry -> IO Bool Source

Returns value indicating if specified Geometry instance is empty

mkReader :: Context -> IO Reader Source

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

mkWriter :: Context -> IO Writer Source

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

readGeometry :: Reader -> String -> IO Geometry Source

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

setOrdinate :: CoordinateSequence -> Word -> Word -> Double -> IO () Source

Sets an x-ordinate value within a coordinate sequence

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

Sets an x-ordinate value within a coordinate sequence

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

Sets a y-ordinate value within a coordinate sequence

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

Sets a 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 String Source

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