HSlippyMap: OpenStreetMap Slippy Map

[ bsd3, geography, library ] [ Propose Tags ] [ Report a vulnerability ]
This version is deprecated.

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 3.0, 3.0.1 (info)
Dependencies base (>=4.6 && <4.7) [details]
License BSD-3-Clause
Author Jean-Alexandre Peyroux
Maintainer m@j4.pe
Category Development
Home page https://github.com/j4/HSlippyMap
Uploaded by j4pe at 2013-12-19T22:22:09Z
Distributions LTSHaskell:3.0.1, NixOS:3.0.1, Stackage:3.0.1
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 11738 total (41 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Successful builds reported [all 2 reports]

Readme for HSlippyMap-1.2

[back to package description]

http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#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))
 
tilex2long x z = x / (2.0 ** z) * 360.0 - 180
 
tiley2lat y z = 180.0 / pi * atan(0.5 * (exp(n) - exp(-n)))
        where
                n = pi - 2.0 * pi * y / (2.0 ** z)
 
-- Exemple
main = do
        --print $ long2tilex 2.2712 17
        --print $ lat2tiley 48.8152 17
        --print $ tilex2long 66362 17
        --print $ tiley2lat 45115 17
        putStrLn "gps: (lat=48.8152,long=2.2712)"
        putStrLn $ "http://tile.openstreetmap.org/17/" ++ show x ++ "/" ++ show y ++ ".png"
        where
                z = 17
                x = long2tilex 2.2712 z
                y = lat2tiley 48.8152 z