geo-uk 0.1.0.1 → 0.1.0.2
raw patch · 3 files changed
+35/−37 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Paths_geo_uk: getBinDir :: IO FilePath
+ Paths_geo_uk: getDataDir :: IO FilePath
+ Paths_geo_uk: getDataFileName :: FilePath -> IO FilePath
+ Paths_geo_uk: getLibDir :: IO FilePath
+ Paths_geo_uk: getLibexecDir :: IO FilePath
+ Paths_geo_uk: getSysconfDir :: IO FilePath
+ Paths_geo_uk: version :: Version
- Data.Geo.OSGM02Tab: gb :: Maybe ArrDD
+ Data.Geo.OSGM02Tab: gb :: ArrDD
Files
- geo-uk.cabal +14/−15
- src/Data/Geo/OSGM02Tab.hs +15/−11
- src/Data/Geo/Point.hs +6/−11
geo-uk.cabal view
@@ -1,8 +1,5 @@--- Initial geo-uk.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/- name: geo-uk-version: 0.1.0.1+version: 0.1.0.2 synopsis: High precision conversion between GPS and UK Grid description: Conversion between GPS and UKGrid Coordinates one approximate and one using table. homepage: https://github.com/tolysz/geo-uk@@ -16,6 +13,9 @@ extra-source-files: data/GB.dat cabal-version: >=1.10 +data-files:+ data/GB.dat+ Flag embeded Description: Embed Static data Default: False@@ -24,18 +24,17 @@ exposed-modules: Data.Geo.OSGM02Tab Data.Geo.Type Data.Geo.Point- -- other-modules: - -- other-extensions: if flag(embeded) cpp-options: -DEMBEDED_DATA- build-depends: bzlib- , file-embed- build-depends: base >=4.7 && < 5- , array- , binary- , bytestring- , th-lift- , template-haskell+ build-depends: file-embed++ build-depends: base >=4.7 && < 5+ , array+ , binary+ , bytestring+ , th-lift+ , template-haskell+ , bzlib hs-source-dirs: src default-language: Haskell2010- ghc-options: -O2+
src/Data/Geo/OSGM02Tab.hs view
@@ -9,22 +9,26 @@ import Data.Maybe import Data.Geo.Type import Data.Array.Unboxed ((!))--#if EMBEDED_DATA import qualified Codec.Compression.BZip as BZip import qualified Data.ByteString.Lazy.Char8 as L8 import Data.Binary (decode)-import Data.FileEmbed-import qualified Data.ByteString--gb :: Maybe ArrDD-gb = Just (decodePTPDDFile . L8.fromStrict $ $(embedFile "data/GB.dat"))+-- import qualified Data.ByteString -decodePTPDDFile :: L8.ByteString -> ArrDD-decodePTPDDFile = decode . BZip.decompress+#if EMBEDED_DATA+import Data.FileEmbed +gb :: ArrDD+gb = decodePTPDDFile . L8.fromStrict $ $(embedFile "data/GB.dat") #else-gb :: Maybe ArrDD-gb = Nothing+import System.IO.Unsafe+import Paths_geo_uk++{-# NOINLINE gb #-}+gb :: ArrDD+gb = unsafePerformIO $ do+ fn <- getDataFileName "data/GB.dat"+ decodePTPDDFile <$> L8.readFile fn #endif +decodePTPDDFile :: L8.ByteString -> ArrDD+decodePTPDDFile = decode . BZip.decompress
src/Data/Geo/Point.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE EmptyDataDecls #-}+-- {-# LANGUAGE EmptyDataDecls #-} module Data.Geo.Point (@@ -110,17 +110,14 @@ no = i + mlam2 * (ii + mlam2 * (iii + iiia * mlam2)) convWGS84ENtoUKOS :: WGS84EN -> UKOS-convWGS84ENtoUKOS pt@(WGS84EN we wn wa) =- case gb of- Just gb' -> UKOS e n h+convWGS84ENtoUKOS pt@(WGS84EN we wn wa) = UKOS e n h where ei = round (we / 1000) ni = round (wn / 1000)- Just gb' = gb- (PTPDD se0 sn0 sg0 ) = gb' ! (ei,ni)- (PTPDD se1 sn1 sg1 ) = gb' ! (ei+1,ni)- (PTPDD se2 sn2 sg2 ) = gb' ! (ei+1,ni+1)- (PTPDD se3 sn3 sg3 ) = gb' ! (ei,ni+1)+ (PTPDD se0 sn0 sg0 ) = gb ! (ei,ni)+ (PTPDD se1 sn1 sg1 ) = gb ! (ei+1,ni)+ (PTPDD se2 sn2 sg2 ) = gb ! (ei+1,ni+1)+ (PTPDD se3 sn3 sg3 ) = gb ! (ei,ni+1) dx = we - 1000 * fromIntegral ei dy = wn - 1000 * fromIntegral ni t = dx / 1000@@ -131,8 +128,6 @@ e = we + se n = wn + sn h = wa - sg- Nothing -> convWGS84ENtoUKOS' pt- convGPStoSHORT = convUKOStoSHORT . convGPStoUKOS convGPStoSHORT' = convUKOStoSHORT . convGPStoUKOS'