Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caneroj1/mbtiles
Haskell MBTiles Library
https://github.com/caneroj1/mbtiles
haskell mbtiles
Last synced: about 1 month ago
JSON representation
Haskell MBTiles Library
- Host: GitHub
- URL: https://github.com/caneroj1/mbtiles
- Owner: caneroj1
- License: bsd-3-clause
- Created: 2017-07-22T02:36:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-08T02:19:01.000Z (over 6 years ago)
- Last Synced: 2024-04-26T07:22:40.672Z (9 months ago)
- Topics: haskell, mbtiles
- Language: Haskell
- Size: 70.3 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mbtiles
Haskell library for interfacing with MapBox [MBTiles](https://github.com/mapbox/mbtiles-spec) files.
Documentation available on [Hackage](https://hackage.haskell.org/package/mbtiles).
## 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:
```haskell
{-# LANGUAGE OverloadedStrings #-}import qualified Data.ByteString.Lazy as BL
import Database.Mbtilesmain = do
let myData = "myTileData" :: BL.ByteString
let tile = Tile (Z 0, X 0, Y 0)
runMbtiles "my/path/to/file.mbtiles" $ do
maybeTileData <- getTile tile
case maybeTileData of
Nothing -> writeTile tile myData
(Just d) -> updateTile tile $ BL.init d
```Getting metadata:
```haskell
import Control.Monad.IO.Class
import Database.Mbtilesmain = 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.