-------------------------------------------------------------------------------- -- -- Module : Main -- Description : GeoJSON parser testing -- Copyright : (c) 2014 Brian W Bush -- License : MIT -- Maintainer : code@bwbush.io -- Stability : experimental -- Portability : portable -- -- | Simple testing of GeoJSON parsing. -- -------------------------------------------------------------------------------- module Main ( main ) where import Data.Aeson (FromJSON, decode) import Data.Geography.GeoJSON (Feature, FeatureCollection, Geometry) import Paths_handa_geodata (getDataFileName) import qualified Data.ByteString.Lazy.Char8 as BS (readFile) main :: IO () main = do print =<< (readTestJSON "Point" :: IO (Maybe Geometry )) print =<< (readTestJSON "MultiPoint" :: IO (Maybe Geometry )) print =<< (readTestJSON "LineString" :: IO (Maybe Geometry )) print =<< (readTestJSON "MultiLineString" :: IO (Maybe Geometry )) print =<< (readTestJSON "Polygon" :: IO (Maybe Geometry )) print =<< (readTestJSON "MultiPolygon" :: IO (Maybe Geometry )) print =<< (readTestJSON "Feature" :: IO (Maybe Feature )) print =<< (readTestJSON "FeatureCollection" :: IO (Maybe FeatureCollection)) readTestJSON :: FromJSON a => String -> IO (Maybe a) readTestJSON name = do file <- getDataFileName $ "geojson/spec/" ++ name ++ ".geojson" json <- BS.readFile file return $ decode json