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