hgis 0.1.2.1 → 0.1.3.0
raw patch · 3 files changed
+29/−28 lines, 3 filesdep ~Chartdep ~Chart-cairodep ~Chart-diagrams
Dependency ranges changed: Chart, Chart-cairo, Chart-diagrams, ansi-wl-pprint, base, binary, bytestring, colour, composition, data-binary-ieee754, data-default, directory, filepath, hgis, hspec, lens, monad-loops, optparse-applicative, transformers
Files
- hgis.cabal +23/−23
- src/GIS/Hylo.hs +1/−1
- src/GIS/Math/Spherical.hs +5/−4
hgis.cabal view
@@ -1,5 +1,5 @@ name: hgis-version: 0.1.2.1+version: 0.1.3.0 cabal-version: >=1.10 build-type: Simple license: BSD3@@ -42,23 +42,23 @@ GIS.Math.Projections build-depends: base >=4.7 && <5,- optparse-applicative >=0.13.2.0,- Chart >=1.8.2,- Chart-cairo >=1.8.2,- Chart-diagrams >=1.8.2,- lens >=4.15.1,- composition >=1.0.2.1,- ansi-wl-pprint >=0.6.7.3,- transformers >=0.5.2.0,- directory >=1.3.0.0,- colour >=2.3.3,- data-default >=0.7.1.1,- binary >=0.8.3.0,- bytestring >=0.10.8.1,- data-binary-ieee754 >=0.4.4,- filepath >=1.4.1.1,- monad-loops >=0.4.3- pkgconfig-depends: cairo >=0.13.3.1+ optparse-applicative >=0.13.2.0 && <0.14,+ Chart >=1.8.2 && <1.9,+ Chart-cairo >=1.8.2 && <1.9,+ Chart-diagrams >=1.8.2 && <1.9,+ lens >=4.15.1 && <4.16,+ composition >=1.0.2.1 && <1.1,+ ansi-wl-pprint >=0.6.7.3 && <0.7,+ transformers >=0.5.2.0 && <0.6,+ directory >=1.3.0.0 && <1.4,+ colour >=2.3.3 && <2.4,+ data-default >=0.7.1.1 && <0.8,+ binary >=0.8.3.0 && <0.9,+ bytestring >=0.10.8.1 && <0.11,+ data-binary-ieee754 >=0.4.4 && <0.5,+ filepath >=1.4.1.1 && <1.5,+ monad-loops >=0.4.3 && <0.5+ pkgconfig-depends: cairo >=0.13.3.1 && <0.14 default-language: Haskell2010 default-extensions: DeriveGeneric OverloadedStrings hs-source-dirs: src src/depends/readshp@@ -84,8 +84,8 @@ ghc-options: -threaded -rtsopts -with-rtsopts=-N main-is: MainPng.hs build-depends:- base >=4.9.1.0,- hgis >=0.1.2.1+ base >=4.9.1.0 && <4.10,+ hgis >=0.1.3.0 && <0.2 default-language: Haskell2010 hs-source-dirs: app @@ -93,9 +93,9 @@ type: exitcode-stdio-1.0 main-is: Spec.hs build-depends:- base >=4.9.1.0,- hgis >=0.1.2.1,- hspec >=2.4.2+ base >=4.9.1.0 && <4.10,+ hgis >=0.1.3.0 && <0.2,+ hspec >=2.4.2 && <2.5 default-language: Haskell2010 hs-source-dirs: test ghc-options: -threaded -rtsopts -with-rtsopts=-N
src/GIS/Hylo.hs view
@@ -22,7 +22,7 @@ -- | Get the areas of various objects and return a string suitable for printing districtArea :: [District] -> String districtArea districts = concat . intercalate (pure "\n") $ map (pure . show . distA) districts- where distA (District _ label _ area) = (label, sum area)+ where distA (District _ label _ area) = (label, sum area) -- TODO figure out which one is the correct one -- should mention it's km -- | Get the perimeters of various objects and return a string suitable for printing
src/GIS/Math/Spherical.hs view
@@ -40,13 +40,14 @@ -- WARNING: not yet to scale. -- (need to compute jacobian; ideally km^2/steridian areaPolygon :: Polygon -> Double-areaPolygon = (*factor) . areaPolyRectangular . (fmap bonne)- where factor = 1 -- 1717856/227.5506494212687+areaPolygon = (*factor) . areaPolyRectangular . fmap (bonne . toRadians)+ where factor = 1717856/4.219690791828533e-2 -- | Find the area of a polygon with rectangular coördinates given. areaPolyRectangular :: Polygon -> Double-areaPolyRectangular (pt:pts) = 0.5 * (fst (foldl' areaPolyCalc (0,pt) pts))- where areaPolyCalc (sum,(x,y)) (xNext,yNext) = (sum + (x * yNext - xNext * y),(xNext,yNext))+areaPolyRectangular (pt:pts) = abs . (*0.5) . fst $ (foldl' areaPolyCalc (0,pt) pts) -- different result with foldl' and foldr? b/c pt gets stuck in different places.+ where areaPolyCalc (sum,(x1,y1)) (x2, y2) = (sum + (x1 * y2 - x2 * y1),(x2,y2)) -- wrong end! should end w/ xny1-ynx1 MAXIMUM values for coordinates don't make any sense? + ((x1, y1),(xn, yn)) = (pt, last pts) -- | Distance in kilometers between two points given in degrees. distance :: (Double, Double) -> (Double, Double) -> Double