| Copyright | (c) Joe Canero 2017 |
|---|---|
| License | BSD3 |
| Maintainer | jmc41493@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Data.Tile
Description
This module provides types and functions for manipulating tiles, latitude/longitude pairs, and pixels.
See the associated README.md for basic usage examples.
Synopsis
- newtype Z = Z Int
- newtype X = X Int
- newtype Y = Y Int
- newtype Tile = Tile (Z, X, Y)
- newtype Lng = Lng Double
- newtype Lat = Lat Double
- newtype LngLat = LngLat (Lng, Lat)
- newtype Px = Px Int
- newtype Py = Py Int
- newtype Pixel = Pixel (Px, Py)
- data BoxOrigin
- data TileBounds = TileBounds BoxOrigin LngLat LngLat
- maxTileIndex :: Z -> Int
- maxTilesInDimension :: Z -> Int
- maxPixelsInDimension :: Z -> Int
- flipY :: Tile -> Tile
- subTiles :: Tile -> [Tile]
- parentTile :: Tile -> Maybe Tile
- mkTile :: Z -> X -> Y -> Maybe Tile
- tilesInBounds :: BoxOrigin -> Z -> (LngLat, LngLat) -> [Tile]
- tileToPixel :: Tile -> Pixel
- lngLatToPixel :: Z -> LngLat -> Pixel
- pixelToTile :: Z -> Pixel -> Tile
- lngLatToTile :: Z -> LngLat -> Tile
- pixelToLngLat :: Z -> Pixel -> LngLat
- tileToLngLat :: Tile -> LngLat
- tileToBounds :: BoxOrigin -> Tile -> TileBounds
Types
Newtype wrapper around a tuple of Lng and Lat representing
a WGS84 latitude and longitude on the map.
Datatype representing the origin point of a bounding box.
data TileBounds #
Constructors
| TileBounds BoxOrigin LngLat LngLat |
Instances
| Eq TileBounds # | |
Defined in Data.Tile | |
| Show TileBounds # | |
Defined in Data.Tile Methods showsPrec :: Int -> TileBounds -> ShowS # show :: TileBounds -> String # showList :: [TileBounds] -> ShowS # | |
Functions
Tile functionality
maxTileIndex :: Z -> Int #
Get the maximum index a tile can have along a given dimension, x or y.
maxTilesInDimension :: Z -> Int #
Get the numbers of tiles in a given dimension, x or y, at the specified map zoom level.
maxPixelsInDimension :: Z -> Int #
Get the number of pixels in a given dimension, x or y, assuming a tile is 256x256px.
Conversions
To Pixel
To Tile
To LngLat
pixelToLngLat :: Z -> Pixel -> LngLat #
To TileBounds
tileToBounds :: BoxOrigin -> Tile -> TileBounds #
Convert a Tile into a TileBounds value representing
the bounding box of that tile.