{-# LANGUAGE TemplateHaskell #-}
module Data.Geospatial.Internal.Geometry.GeoLine (
GeoLine(..)
, unGeoLine
) where
import Data.Geospatial.Internal.BasicTypes
import Data.Geospatial.Internal.Geometry.Aeson
import Data.LineString
import Control.Lens (makeLenses)
import Control.Monad (mzero)
import Data.Aeson (FromJSON (..),
ToJSON (..),
Value (..))
newtype GeoLine = GeoLine { _unGeoLine :: LineString GeoPositionWithoutCRS } deriving (Show, Eq)
makeLenses ''GeoLine
instance ToJSON GeoLine where
toJSON = makeGeometryGeoAeson "LineString" . _unGeoLine
instance FromJSON GeoLine where
parseJSON (Object o) = readGeometryGeoAeson "LineString" GeoLine o
parseJSON _ = mzero