| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Database.Esqueleto.Postgis
Description
Haskell bindings for postgres postgis for a good explenation see https://postgis.net/
Synopsis
- data PostgisGeometry point
- = Point point
- | MultiPoint (NonEmpty point)
- | Line (LineString point)
- | Multiline (NonEmpty (LineString point))
- | Polygon (LinearRing point)
- | MultiPolygon (NonEmpty (LinearRing point))
- | Collection (NonEmpty (PostgisGeometry point))
- makePolygon :: (Eq point, Show point) => point -> point -> point -> Seq point -> LinearRing point
- getPoints :: PostgisGeometry point -> NonEmpty point
- st_contains :: SqlExpr (Value (PostgisGeometry a)) -> SqlExpr (Value (PostgisGeometry a)) -> SqlExpr (Value Bool)
- st_intersects :: SqlExpr (Value (PostgisGeometry a)) -> SqlExpr (Value (PostgisGeometry a)) -> SqlExpr (Value Bool)
- st_union :: SqlExpr (Value (PostgisGeometry a)) -> SqlExpr (Value (PostgisGeometry a))
- point :: Double -> Double -> PostgisGeometry PointXY
- st_point :: SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value (PostgisGeometry PointXY))
- st_point_xyz :: SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value (PostgisGeometry PointXYZ))
- st_point_xyzm :: SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value (PostgisGeometry PointXYZM))
- data PointXY = PointXY {}
- data PointXYZ = PointXYZ {}
- data PointXYZM = PointXYZM {}
Documentation
data PostgisGeometry point Source #
like GeospatialGeometry but not partial, eg no empty geometries, also only works
in a single dimention, eg PostgisGeometry PointXY can't work with PostgisGeometry PointXYZ.
so PointXY indicates a 2 dimension space, and PointXYZ a three dimension space.
Constructors
| Point point | |
| MultiPoint (NonEmpty point) | |
| Line (LineString point) | |
| Multiline (NonEmpty (LineString point)) | |
| Polygon (LinearRing point) | |
| MultiPolygon (NonEmpty (LinearRing point)) | |
| Collection (NonEmpty (PostgisGeometry point)) |
Instances
makePolygon :: (Eq point, Show point) => point -> point -> point -> Seq point -> LinearRing point Source #
checks if the first point is the last, and if not so makes it so. this is required for inserting into the database
getPoints :: PostgisGeometry point -> NonEmpty point Source #
unwrap postgis geometry so you can for example return it from an API
functions
Arguments
| :: SqlExpr (Value (PostgisGeometry a)) | geom a |
| -> SqlExpr (Value (PostgisGeometry a)) | geom b |
| -> SqlExpr (Value Bool) |
Returns TRUE if geometry A contains geometry B. https://postgis.net/docs/ST_Contains.html
st_intersects :: SqlExpr (Value (PostgisGeometry a)) -> SqlExpr (Value (PostgisGeometry a)) -> SqlExpr (Value Bool) Source #
Returns true if two geometries intersect. Geometries intersect if they have any point in common. https://postgis.net/docs/ST_Intersects.html
st_union :: SqlExpr (Value (PostgisGeometry a)) -> SqlExpr (Value (PostgisGeometry a)) Source #
allows union of geometries, eg group a bunch together, for example:
mCombined <- selectOne $ do grid <- from $ tableGrid pure $ st_union $ grid ^. GridGeom select $ do unit <- from $ tableUnit forM_ mCombined $ combined -> where_ $ (unit ^. UnitGeom)st_intersects(val $ unValue combined) pure unit
points
st_point :: SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value (PostgisGeometry PointXY)) Source #
st_point_xyz :: SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value (PostgisGeometry PointXYZ)) Source #
st_point_xyzm :: SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value Double) -> SqlExpr (Value (PostgisGeometry PointXYZM)) Source #
re-exports
(GeoPositionWithoutCRS is a catch all for indeterminate CRSs and for expression of positions
before a CRS has been determined
Instances
Instances
| Generic PointXYZ | |||||
Defined in Data.Geospatial.Internal.BasicTypes Associated Types
| |||||
| Show PointXYZ | |||||
| NFData PointXYZ | |||||
Defined in Data.Geospatial.Internal.BasicTypes | |||||
| Eq PointXYZ | |||||
| PersistField (PostgisGeometry PointXYZ) Source # | |||||
Defined in Database.Esqueleto.Postgis Methods toPersistValue :: PostgisGeometry PointXYZ -> PersistValue # fromPersistValue :: PersistValue -> Either Text (PostgisGeometry PointXYZ) # | |||||
| PersistFieldSql (PostgisGeometry PointXYZ) Source # | |||||
Defined in Database.Esqueleto.Postgis | |||||
| type Rep PointXYZ | |||||
Defined in Data.Geospatial.Internal.BasicTypes type Rep PointXYZ = D1 ('MetaData "PointXYZ" "Data.Geospatial.Internal.BasicTypes" "geojson-4.1.3-Fo30Mslj2kvEdjJnkBQigF" 'False) (C1 ('MetaCons "PointXYZ" 'PrefixI 'True) (S1 ('MetaSel ('Just "_xyzX") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: (S1 ('MetaSel ('Just "_xyzY") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "_xyzZ") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)))) | |||||
Instances
| Generic PointXYZM | |||||
Defined in Data.Geospatial.Internal.BasicTypes Associated Types
| |||||
| Show PointXYZM | |||||
| NFData PointXYZM | |||||
Defined in Data.Geospatial.Internal.BasicTypes | |||||
| Eq PointXYZM | |||||
| PersistField (PostgisGeometry PointXYZM) Source # | |||||
Defined in Database.Esqueleto.Postgis Methods toPersistValue :: PostgisGeometry PointXYZM -> PersistValue # fromPersistValue :: PersistValue -> Either Text (PostgisGeometry PointXYZM) # | |||||
| PersistFieldSql (PostgisGeometry PointXYZM) Source # | |||||
Defined in Database.Esqueleto.Postgis | |||||
| type Rep PointXYZM | |||||
Defined in Data.Geospatial.Internal.BasicTypes type Rep PointXYZM = D1 ('MetaData "PointXYZM" "Data.Geospatial.Internal.BasicTypes" "geojson-4.1.3-Fo30Mslj2kvEdjJnkBQigF" 'False) (C1 ('MetaCons "PointXYZM" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_xyzmX") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "_xyzmY") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)) :*: (S1 ('MetaSel ('Just "_xyzmZ") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "_xyzmM") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)))) | |||||
Orphan instances
| PersistField PointXY Source # | |
Methods toPersistValue :: PointXY -> PersistValue # | |
| PersistFieldSql PointXY Source # | |