Giter VIP home page Giter VIP logo

mbtiles's Introduction

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
  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:

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.

mbtiles's People

Contributors

caneroj1 avatar albertov avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.