tile: Slippy map tile functionality.

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]

Tile/lonlat conversion utilities for slippy maps.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.3.0.0
Dependencies base (>=4.7 && <5) [details]
License BSD-3-Clause
Copyright Copyright: (c) 2017 Joe Canero
Author Joe Canero
Maintainer jmc41493@gmail.com
Category Data
Home page https://github.com/caneroj1/tile#readme
Source repo head: git clone https://github.com/caneroj1/tile
Uploaded by jmc41493 at 2017-10-26T01:44:25Z
Distributions LTSHaskell:0.3.0.0, NixOS:0.3.0.0, Stackage:0.3.0.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2070 total (15 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-10-26 [all 1 reports]

Readme for tile-0.3.0.0

[back to package description]

tile

Haskell library for interfacing with slippy map tiles and converting between Pixel, Tile, and LngLat types.

Basic Usage

Converting between the three main types, Pixel, Tile, and LngLat is a major piece of this library's functionality.

Convert LngLat to Tile

Convert a longitude and latitude pair at a given zoom level into a tile.


lngLatToTile (Z 8) (LngLat (Lng (-74.17250), Lat 40.39187))
-- returns Tile (Z 8, X 75, Y 96)

Convert LngLat to Pixel

Convert a longitude and latitude pair at a given zoom level into a pixel on the map.


lngLatToPixel (Z 8) (LngLat (Lng (-74.17250), Lat 40.39187))
-- returns Pixel (Px 19265,Py 24717)

Convert Tile to LngLat

Convert a tile back to a longitude and latitude pair.


tileToLngLat (Tile (Z 1, X 1, Y 0))
-- returns LngLat (Lng 0.0, Lat 85.05112877980659)

Convert Tile to Pixel

Convert a tile into a pixel on the map.


tileToPixel (Tile (Z 1, X 1, Y 0))
-- returns Pixel (Px 256,Py 0)

Convert Pixel to Tile

Convert a pixel to a tile.


pixelToTile (Z 1) $ Pixel (Px 256,Py 0)
-- returns Tile (Z 1,X 1,Y 0)

Convert Pixel to LngLat

Convert a pixel into a longitude and latitude pair.


pixelToLngLat (Z 8) $ Pixel (Px 19265,Py 24717)
-- returns LngLat (Lng (-74.1741943359375),Lat 40.39258071969131)

Subtiles

Get the children of a given tile.


subTiles (Tile (Z 1, X 1, Y 0))
-- returns [
--    Tile (Z 2, X 2, Y 0)
--  , Tile (Z 2, X 2, Y 1)
--  , Tile (Z 2, X 3, Y 0)
--  , Tile (Z 2, X 3, Y 1)
--  ]

Parent tiles

Get the parent of a given tile.


parentTile (Tile (Z 1, X 1, Y 0))
-- returns Just (Tile (Z 0, X 0, Y 0))

Tile Bounds

Convert a tile into a bounding box.

Oriented from the SW


tileToBounds SW (Tile (Z 8, X 75, Y 96))
-- returns TileBounds SW (LngLat (Lng (-74.53125), Lat 39.90973623453718))
--                       (LngLat (Lng (-73.125), Lat 40.97989806962013))

Oriented from the NW


tileToBounds NW (Tile (Z 8, X 75, Y 96))
-- returns TileBounds SW (LngLat (Lng (-74.53125), Lat 40.97989806962013))
--                       (LngLat (Lng (-73.125), Lat 39.90973623453718))

Contributing

Contributions are welcome!