HSlippyMap 2.6 → 3.0
raw patch · 2 files changed
+13/−12 lines, 2 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- HSlippyMap: tilesFromBBox :: Tile -> Tile -> [Tile]
+ HSlippyMap: tilesFromBBox :: Tile -> Tile -> Maybe [Tile]
Files
- HSlippyMap.cabal +2/−2
- HSlippyMap.hs +11/−10
HSlippyMap.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: HSlippyMap-version: 2.6+version: 3.0 synopsis: OpenStreetMap Slippy Map -- description: homepage: https://github.com/apeyroux/HSlippyMap@@ -20,4 +20,4 @@ exposed-modules: HSlippyMap default-language: Haskell2010 -- other-modules:- build-depends: base ==4.*+ build-depends: base >=4.6 && <5
HSlippyMap.hs view
@@ -21,16 +21,17 @@ instance Show Tile where show (Tile lat long x y z) = "http://tile.openstreetmap.org/" ++ show z ++ "/" ++ show x ++ "/" ++ show y ++ ".png" --- ajouter un test si z1 == z2 puis maybe-tilesFromBBox :: Tile -> Tile -> [Tile]-tilesFromBBox min max = concat $ map (\(x,y) -> map (\y'-> Tile (tlat min) (tlong min) x y' z) y)- [(x,[(minimum [tymin, tymax])..(maximum [tymin,tymax])]) | x <- [(minimum [txmin, txmax])..(maximum [txmin, txmax])]]- where- txmax = tx max- txmin = tx min- tymax = ty max- tymin = ty min- z = tz min+-- if not same z-level == Nothing+tilesFromBBox :: Tile -> Tile -> Maybe [Tile]+tilesFromBBox min max | (tz min) == (tz max) = Just $ concat $ map (\(x,y) -> map (\y'-> Tile (tlat min) (tlong min) x y' z) y)+ [(x,[(minimum [tymin, tymax])..(maximum [tymin,tymax])]) | x <- [(minimum [txmin, txmax])..(maximum [txmin, txmax])]]+ | otherwise = Nothing+ where+ txmax = tx max+ txmin = tx min+ tymax = ty max+ tymin = ty min+ z = tz min tileFromLatLong :: Lat -> Long -> ZLevel -> Tile tileFromLatLong lat lon z = Tile lat lon x y z