osm-download-0.1.2: Download Open Street Map tiles

Network.OSM

Contents

Synopsis

Types

data TileCoords Source

The coordinates associated with any particular GPS location can be computed using determineTileCoords and converted into tile ids using selectedTiles before final download with downloadTiles.

Constructors

TileCoords 

Fields

minX :: Int
 
maxX :: Int
 
minY :: Int
 
maxY :: Int
 

High Level Operations

downloadBestFitTiles :: (Lat a, Lon a) => String -> [a] -> IO [[ByteString]]Source

Takes the tile server base URL, the set of coordinates that must appear within the map boundaries, and users the downloadTiles function to acquire all the necessary tiles.

The returned files should all be in an approriate grid for row/column display. See the test files of Main.hs and Main2.hs for examples of Repa stiching tiles into a single image or side by side display of individual tiles.

osmTileURL :: StringSource

The official OSM tile server.

pixelPosForCoord :: (Lon a, Lat a, Integral t) => [a] -> TileCoords -> Int -> (t, t)Source

Takes a WptType, the OSM tile boundaries, and a zoom level then generates (x,y) points to be placed on the Image.

Low level and helper functions

determineTileCoords :: (Lat a, Lon a) => [a] -> Int -> Maybe TileCoordsSource

Computes the rectangular map region to download based on GPS points and a zoom level

selectedTiles :: TileCoords -> [[TileID]]Source

Takes the boundaries of the OSM tiles, and generates a list of the encompassed OSM tiles.

downloadTiles :: String -> [[TileID]] -> Int -> IO [[ByteString]]Source

Takes the boundaries of the OSM tiles and downloads the tiles, keeping them in proper grid patterns for latter stiching or side-by-side display.

Legal

copyrightText :: StringSource

The suggested copyright text in accordance with http://wiki.openstreetmap.org/wiki/Legal_FAQ