mbtiles: Haskell MBTiles client.

[ bsd3, database, library ] [ Propose Tags ]

Read and manipulate MBTiles files and associated metadata.


[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.2.0.0, 0.3.0.0, 0.4.0.0, 0.6.0.0
Dependencies base (>=4.7 && <5), bytestring, directory, monad-control, mtl, resource-pool, sqlite-simple, text, transformers, unordered-containers [details]
License BSD-3-Clause
Copyright Copyright: (c) 2017 Joe Canero
Author Joe Canero
Maintainer jmc41493@gmail.com
Category Database
Home page https://github.com/caneroj1/mbtiles#readme
Source repo head: git clone https://github.com/caneroj1/mbtiles
Uploaded by jmc41493 at 2017-09-02T19:11:27Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 3485 total (12 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-09-02 [all 1 reports]

Readme for mbtiles-0.6.0.0

[back to package description]

mbtiles

Haskell library for interfacing with MapBox MBTiles files.

Documentation available on Hackage.

Functionality

  • Getting tiles by zoom, x, and y.
  • Writing new tiles by zoom, x, and y.
  • Updating existing tiles by zoom, x, and y.
  • Accessing metadata from the mbtiles file.

Basic Usage

Reading, writing, and updating tiles:

{-# LANGUAGE OverloadedStrings #-}

import qualified Data.ByteString.Lazy as BL
import           Database.Mbtiles

main = do
  let myData = "myTileData" :: BL.ByteString
  runMbtiles "my/path/to/file.mbtiles" $ do
    maybeTileData <- getTile (Z 0) (X 0) (Y 0)
    case maybeTileData of
      Nothing  -> writeTile (Z 0) (X 0) (Y 0) myData
      (Just d) -> updateTile (Z 0) (X 0) (Y 0) $ BL.init d

Getting metadata:


import Control.Monad.IO.Class
import Database.Mbtiles

main = do
  runMbtiles "my/path/to/file.mbtiles" $ do
    liftIO . print =<< getName
    liftIO . print =<< getType
    liftIO . print =<< getFormat

Future Work

  • Improve database error handling.
  • Investigate usage as a performant tile server.
  • Add tests.