HSlippyMap 1.2 → 1.4
raw patch · 4 files changed
+14/−12 lines, 4 files
Files
- HSlippyMap.cabal +4/−4
- HSlippyMap.hs +5/−8
- README.md +5/−0
- hsl.hs +0/−0
HSlippyMap.cabal view
@@ -2,9 +2,9 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: HSlippyMap-version: 1.2+version: 1.4 synopsis: OpenStreetMap Slippy Map-description: Use OpenStreetMap Slippy Map with Haskell : http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Haskell+-- description: homepage: https://github.com/j4/HSlippyMap license: BSD3 license-file: LICENSE@@ -16,6 +16,6 @@ cabal-version: >=1.8 library- exposed-modules: HSlippyMap- -- other-modules: + exposed-modules: HSlippyMap+ -- other-modules: build-depends: base ==4.6.*
HSlippyMap.hs view
@@ -1,5 +1,4 @@ module HSlippyMap (- -- * HSlippyMap Tile, tileFromLatLong, tileFromGPS@@ -7,29 +6,27 @@ type Lat = Float type Long = Float-type GpsX = Integer-type GpsY = Integer+type X = Integer+type Y = Integer type ZLevel = Integer data Tile = Tile { lat :: Lat, long :: Long,- x :: GpsX,- y :: GpsY,+ x :: X,+ y :: Y, z :: ZLevel } instance Show Tile where show (Tile lat long x y z) = "http://tile.openstreetmap.org/" ++ show z ++ "/" ++ show x ++ "/" ++ show y ++ ".png" --- | Create Tile from Lat Long tileFromLatLong :: Lat -> Long -> ZLevel -> Tile tileFromLatLong lat lon z = Tile lat lon x y z where x = long2tilex lon z y = lat2tiley lat z --- | Create Tile from GPS X Y-tileFromGPS :: GpsX -> GpsY -> ZLevel -> Tile+tileFromGPS :: X -> Y -> ZLevel -> Tile tileFromGPS x y z = Tile lat lon x y z where lat = tilex2long x z
README.md view
@@ -1,6 +1,11 @@ http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Haskell ```haskell+mapM (\z-> putStrLn $ show $ tileFromLatLong 12.3 3.3 z) [0..18]+```+++```haskell long2tilex lon z = floor((lon + 180.0) / 360.0 * (2.0 ** z)) lat2tiley lat z = floor((1.0 - log( tan(lat * pi/180.0) + 1.0 / cos(lat * pi/180.0)) / pi) / 2.0 * (2.0 ** z))
hsl.hs view