hgis 1.0.0.0 → 1.0.0.1
raw patch · 15 files changed
+102/−57 lines, 15 filesdep ~base
Dependency ranges changed: base
Files
- cabal.project.local +1/−4
- hgis.cabal +20/−13
- src/GIS/Graphics/Plot.hs +8/−1
- src/GIS/Graphics/PlotPNG.hs +8/−2
- src/GIS/Graphics/PlotSVG.hs +4/−2
- src/GIS/Graphics/Types.hs +13/−8
- src/GIS/Hylo.hs +11/−2
- src/GIS/Math/Projections.hs +2/−2
- src/GIS/Math/Spherical.hs +2/−1
- src/GIS/Utils.hs +6/−1
- src/depends/readshp/Geometry/Shapefile/Internal.hs +13/−2
- src/depends/readshp/Geometry/Shapefile/MergeShpDbf.hs +0/−1
- src/depends/readshp/Geometry/Shapefile/ReadShp.hs +0/−3
- src/depends/readshp/Geometry/Shapefile/Types.hs +14/−1
- stack.yaml +0/−14
cabal.project.local view
@@ -1,5 +1,2 @@-constraints: hgis +development +cairo-with-compiler: ghc-8.2.2+constraints: hgis +development +cairo +diagrams optimization: 2-documentation: true-tests: true
hgis.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: hgis-version: 1.0.0.0+version: 1.0.0.1 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2016-2018 Vanessa McHale@@ -15,7 +15,6 @@ build-type: Simple extra-source-files: cabal.project.local- stack.yaml extra-doc-files: README.md docs/manual.tex src/depends/readshp/LICENSE@@ -33,14 +32,16 @@ flag cairo description: Enable build using cairo backend, allowing generation of PNGs- default: True +flag diagrams+ description:+ Enable build using diagrams backend, allowing generation of SVGs+ library exposed-modules: GIS.Math.Projections GIS.Math.Spherical GIS.Hylo- GIS.Graphics.PlotSVG hs-source-dirs: src src/depends/readshp other-modules: GIS.Graphics.Types@@ -56,11 +57,13 @@ Geometry.Shapefile.Internal default-language: Haskell2010 default-extensions: DeriveGeneric OverloadedStrings- ghc-options: -Wall+ other-extensions: RankNTypes TemplateHaskell FlexibleInstances+ RecordWildCards+ ghc-options: -Wall -Wincomplete-uni-patterns+ -Wincomplete-record-updates -Wmissing-export-lists build-depends:- base >=4.7 && <5,+ base >=4.11 && <5, Chart -any,- Chart-diagrams -any, lens -any, composition-prelude >=1.1.0.1, ansi-wl-pprint -any,@@ -77,15 +80,20 @@ exposed-modules: GIS.Graphics.PlotPNG + if flag(diagrams)+ exposed-modules:+ GIS.Graphics.PlotSVG+ if flag(cairo) build-depends: Chart-cairo -any + if flag(diagrams)+ build-depends:+ Chart-diagrams -any+ if flag(development) ghc-options: -Werror- - if impl(ghc >=8.0)- ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates test-suite hgis-test type: exitcode-stdio-1.0@@ -93,6 +101,8 @@ hs-source-dirs: test default-language: Haskell2010 ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ -Wincomplete-uni-patterns -Wincomplete-record-updates+ -Wmissing-export-lists build-depends: base -any, hgis -any,@@ -100,6 +110,3 @@ if flag(development) ghc-options: -Werror- - if impl(ghc >=8.0)- ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates
src/GIS/Graphics/Plot.hs view
@@ -2,7 +2,14 @@ {-# LANGUAGE RecordWildCards #-} -- | Module containing renderable objects and plots for our maps-module GIS.Graphics.Plot where+module GIS.Graphics.Plot ( mkMapR+ , mkRenderablePlots+ , mkRenderableLens+ , mkRenderableLabelled+ , plotDataPoints+ , labelByLens+ , plotLabels+ ) where import Control.Arrow import Data.Colour.Names
src/GIS/Graphics/PlotPNG.hs view
@@ -1,10 +1,14 @@ {-# LANGUAGE RankNTypes #-} -- | Module to generate PNGs from shapefiles-module GIS.Graphics.PlotPNG where+module GIS.Graphics.PlotPNG ( fileOptions+ , mkMap+ , mkLensMap+ , mkMapPng+ , makeLensMapPng+ ) where import Control.Lens hiding (lens)-import Data.Semigroup import GIS.Graphics.Plot import GIS.Graphics.PlotSVG hiding (fileOptions) import GIS.Graphics.Types hiding (title)@@ -12,6 +16,8 @@ import GIS.Utils import Graphics.Rendering.Chart.Backend.Cairo import Graphics.Rendering.Chart.Easy hiding (lens)++-- FIXME allow all for cairo -- | Default file options: PNG output and 1920x1080. To change the file size, -- you can do e.g.
src/GIS/Graphics/PlotSVG.hs view
@@ -1,9 +1,11 @@ {-# LANGUAGE RankNTypes #-} -- | Module to generate SVGs from shapefiles.-module GIS.Graphics.PlotSVG where+module GIS.Graphics.PlotSVG ( fileOptions+ , mkMapSVG+ , makeLensMapSVG+ ) where -import Data.Semigroup import GIS.Graphics.Plot import GIS.Graphics.Types hiding (title) import GIS.Types
src/GIS/Graphics/Types.hs view
@@ -1,16 +1,21 @@ {-# LANGUAGE TemplateHaskell #-} --- | Module for types associated with generating maps. Includes lenses. -module GIS.Graphics.Types where+-- | Module for types associated with generating maps. Includes lenses.+module GIS.Graphics.Types ( Map (..)+ , projection+ , title+ , labelEntities+ , labelledDistricts+ ) where -import Data.Default-import GIS.Types-import Control.Lens+import Control.Lens+import Data.Default+import GIS.Types -- | Data type for a map-data Map = Map { _projection :: Projection- , _title :: String- , _labelEntities :: Bool -- whether to label districts+data Map = Map { _projection :: Projection+ , _title :: String+ , _labelEntities :: Bool -- whether to label districts , _labelledDistricts :: [([Polygon], String)] -- the data we actually want to map }
src/GIS/Hylo.hs view
@@ -2,13 +2,22 @@ {-# LANGUAGE RecordWildCards #-} -- | Module to transform shapefiles.-module GIS.Hylo where+module GIS.Hylo ( districtArea+ , districtPerimeter+ , districtCompactness+ , districtToMapP+ , districtToMapLensP+ , districtToMapLens+ , districtToMap+ , districtToMapFilesP+ , getDistricts+ , getPolygon+ ) where import Control.Lens hiding (lens) import Data.Default import Data.List import Data.Maybe-import Data.Semigroup import Geometry.Shapefile.MergeShpDbf import Geometry.Shapefile.ReadShp import Geometry.Shapefile.Types
src/GIS/Math/Projections.hs view
@@ -79,10 +79,10 @@ phi2 = radians 50 (referenceLong, referenceLat) = referencePoint --- | Helper to project given a `Polygon`.+-- | Project given a `Polygon`. project :: Projection -> Polygon -> Polygon project f = fmap (f . toRadians) --- | Helper to apply a projection given a `Map`.+-- | Apply a given projection a `Map`. projectMap :: Projection -> Map -> Map projectMap p = over labelledDistricts (fmap (first (fmap (project p))))
src/GIS/Math/Spherical.hs view
@@ -59,7 +59,8 @@ perimeterPolygon (x1:x2:points) = perimeterPolygon (x2:points) + distance x1 x2 perimeterPolygon _ = error "Attempted to take area of polygon with no points" --- | Find the area of a polygon with rectangular coördinates given.+-- | Find the area of a polygon with rectangular coördinates given. This+-- function will error if given a polygon with no points. areaPolyRectangular :: Polygon -> Double areaPolyRectangular (pt:pts) = abs . (*0.5) . fst $ foldr areaPolyCalc (0,pt) pts where areaPolyCalc (x2, y2) (sum',(x1,y1)) = (sum' + (x1 * y2 - x2 * y1),(x2,y2))
src/GIS/Utils.hs view
@@ -1,9 +1,14 @@ -- | Miscellaneous utils and helper functions.-module GIS.Utils where+module GIS.Utils ( stripExt+ , getExt+ , labels+ , flatten+ ) where import Control.Composition import Data.Char +-- TODO replace this with something better -- | Strip extension from a filepath stripExt :: String -> String stripExt = reverse . drop 1 . dropWhile (/='.') . reverse
src/depends/readshp/Geometry/Shapefile/Internal.hs view
@@ -4,10 +4,21 @@ Author : Sam van Herwaarden <samvherwaarden@gmail.com> -} -module Geometry.Shapefile.Internal where+module Geometry.Shapefile.Internal ( getInt8+ , getIntBE+ , getInt16BE+ , getIntLE+ , getInt16LE+ , getString+ , getPoint+ , getCharVal+ , getPointList+ , steps+ , Point+ ) where import Control.Monad (replicateM)-import Data.Binary.Get+import Data.Binary.Get hiding (getInt8) import Data.Binary.IEEE754 (getFloat64le) import qualified Data.ByteString.Char8 as C
src/depends/readshp/Geometry/Shapefile/MergeShpDbf.hs view
@@ -7,7 +7,6 @@ module Geometry.Shapefile.MergeShpDbf ( readShpWithDbf ) where import qualified Data.ByteString.Lazy as BL-import Data.Semigroup import Geometry.Shapefile.ReadDbf import Geometry.Shapefile.ReadShp import Geometry.Shapefile.Types
src/depends/readshp/Geometry/Shapefile/ReadShp.hs view
@@ -13,10 +13,7 @@ import Control.Monad.Loops (whileM) import Data.Binary.Get import Data.Binary.IEEE754 (getFloat64le)-import Data.Semigroup- import qualified Data.ByteString.Lazy as BL- import Geometry.Shapefile.Internal import Geometry.Shapefile.Types
src/depends/readshp/Geometry/Shapefile/Types.hs view
@@ -7,7 +7,20 @@ Author : Sam van Herwaarden <samvherwaarden@gmail.com> -} -module Geometry.Shapefile.Types where+module Geometry.Shapefile.Types ( ShpData (..)+ , ShpHeader (..)+ , ShpType (..)+ , zTypes+ , mTypes+ , shpTypeFromId+ , RecBBox (..)+ , RecContents (..)+ , ShpRec (..)+ , ShpBBox (..)+ , DbfFieldDesc (..)+ , DbfData (..)+ , DbfRecord (..)+ ) where import qualified Data.ByteString as BS
− stack.yaml
@@ -1,14 +0,0 @@-----resolver: lts-11.6-extra-deps:- - Chart-diagrams-1.8.3- - composition-prelude-1.3.0.8- - SVGFonts-1.6.0.3- - diagrams-core-1.4.0.1- - diagrams-lib-1.4.2- - diagrams-postscript-1.4- - diagrams-svg-1.4.1.1- - diagrams-solve-0.1.1- - dual-tree-0.2.1.1- - lens-4.15.4- - free-4.12.4