module GIS.Graphics.PlotPNG where
import Graphics.Rendering.Chart
import Graphics.Rendering.Chart.Easy
import Graphics.Rendering.Chart.Backend.Cairo
import GIS.Types
import Data.Monoid
import Control.Monad
import GIS.Hylo
import GIS.Math.Projections
import Control.Lens
import Control.Lens.Tuple
import GIS.Math.Spherical
import GIS.Utils
import GIS.Graphics.Plot
import GIS.Graphics.Types
import GIS.Graphics.PlotSVG hiding (fileOptions)
fileOptions = def { _fo_size = (1920, 1080) , _fo_format = PNG }
mkMap :: FilePath -> Map -> IO ()
mkMap filepath map = case getExt filepath of
"png" -> mkMapPng filepath map
"svg" -> mkMapSVG filepath map
mkMapPng :: FilePath -> Map -> IO ()
mkMapPng path map = do
renderableToFile fileOptions path $ mkMapR map
putStrLn ("...output written to " <> path)