postgis-trivial-0.0.1.0: PostGIS extention driver based on postgresql-simple package
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.Postgis.Trivial.Unboxed

Description

Allows PostGIS to work with geospatial data enclosed in Traversable data structures with Unboxed Vectors as the most inner structures.

Example of suitable data types for LineString and Polygon.

{-# LANGUAGE TypeFamilies #-}

import qualified Data.Vector.Unboxed as VU

type instance Cast (Double, Double, Double) = P3DZ

instance Castable (Double, Double, Double) where
    toPointND (x, y, z) = Point3DZ x y z
    fromPointND (Point3DZ x y z) = (x, y, z)

type LineStringData = VU.Vector (Double, Double, Double)
type PolygonData = [VU.Vector (Double, Double, Double)]

Documentation