packages feed

hgis-1.0.0.3: test/Spec.hs

module Main (main) where

import           Data.Maybe
import           GIS.Graphics.PlotPNG
import           GIS.Graphics.PlotSVG
import           GIS.Hylo
import           Math.Geometry.Spherical
import           Test.Hspec

main :: IO ()
main = hspec $ do
    describe "distance" $
        it "computes distances along geodesics" $
            distance (6371 :: Double) (-74.0059, 40.7128) (-118.2347, 34.0522) `shouldBe` 3934.997673163554
    describe "mercatorFullPng" $
        it "Reads a map and writes a .png with the Bonne projection" $
            (mkMapPng "test/testmap.png" =<< districtToMapP (bonne (radians 45) (snd washingtonDC)) . fromJust <$> getDistricts "test/data/worldmap/TM_WORLD_BORDERS-0.3.shp") >>= (`shouldBe` ())
    describe "mercatorFullSVG" $
        it "Reads a map and writes a .svg with the Bonne projection" $
            (mkMapSVG "test/testmap.svg" =<< districtToMapP (bonne (radians 45) (snd washingtonDC)) . fromJust <$> getDistricts "test/data/worldmap/TM_WORLD_BORDERS-0.3.shp") >>= (`shouldBe` ())