geojson-4.0.2: A thin GeoJSON Layer above the aeson library

Copyright(C) 2014-2019 HS-GeoJSON Project
LicenseBSD-style (see the file LICENSE.md)
MaintainerAndrew Newman
Safe HaskellNone
LanguageHaskell2010

Data.Geospatial.Internal.Geometry.Aeson

Contents

Description

Some helpers for some of the common Aeson ops

Synopsis

Geometry

readGeometryGeoAeson :: (FromJSON a, FromJSON b) => String -> (a -> b) -> Object -> Parser b Source #

A generic function that can be used to read in the GeoJSON for: GeoPoint, GeoMultiPoint, GeoLine, GeoMultiLine, GeoPolygon and GeoMultiPolygon Takes in a String for the GeoJSON geometry type, the type constructor for the datatype and the JSON object containing both the 'type' val and the coordinates val

makeGeometryGeoAeson :: ToJSON a => String -> a -> Value Source #

The inverse to the above, you just give it the type string and the value for the coordinates and it will create the JSON object

Optional fields

optValFromObj :: FromJSON a => Text -> Object -> Parser (Maybe a) Source #

get an optional value out of a JSON object:

optAttributes :: ToJSON a => Text -> Maybe a -> [Pair] Source #

The other way around, given an optional value, will return the attributes that should be added to the makeObj input