Skip to content
Provides a compatible WMTS Tile Server from MBTiles.
JavaScript Dockerfile TypeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
config Updates to MBTiles Server Jun 28, 2017
public Updates to MBTiles Server Jun 28, 2017
routes Merge pull request #13 from dburnsii/master Aug 7, 2019
test/fixtures Clean repo for v2.0 Jun 3, 2017
utils Fix style guide lint errors Jun 26, 2019
.dockerignore
.gitignore Major release Jun 3, 2017
.travis.yml
CHANGELOG.md
Dockerfile
LICENSE Update LICENSE Mar 5, 2017
README.md
bench.js Fix style guide lint errors Jun 26, 2019
index.d.ts
index.js
package.json bump version 3.2.0 Aug 7, 2019
test.js Fix style guide lint errors Jun 26, 2019
types.ts Add watch files as an option Jul 26, 2017
yarn.lock Update dependencies, bump node version Jun 26, 2019

README.md

MBTiles Server

Build Status Coverage Status npm version MIT licensed

Standard - JavaScript Style Guide

Provides a compatible WMTS Tile Server from MBTiles.

Install

$ npm install -g mbtiles-server

Quickstart

$ mbtiles-server --cache /Users/mac/mbtiles --verbose --port 3000
MBTiles Server Service

  cache:         /Users/mac/mbtiles
  protocol:      http
  port:          3000
  domain:        localhost
  verbose:       true

Benchmark

  • 1 Active User => 400 requests/min
  • 1 Passive User => 50 requests/min
Requests Response Time
1 33.460ms
10 45.223ms
100 374.217ms
1K 2.698s
10K 25.457s

Total 24,000 requests / min

Using mbtiles-server you could easily sustain 60 active users and up to 480 passive users. These tests were done on the server locally, network traffic and switches could slow down these results significantly.

CLI Help

For any additional help using the CLI, use the --help flag.

  Provides a compatible WMTS Tile Server from MBTiles.

  Usage
    $ mbtiles-server

  Options
    --cache           [~/mbtiles] Cache
    --protocol        [http] Protocol
    --port            [5000] Port
    --domain          [localhost] Domain
    --verbose         [false] Verbose output

  Examples
    $ mbtiles-server --cache /Users/mac/mbtiles --port 5000 --verbose

Environment Variables

Environment variables can be defined instead of entering your options via the CLI.

  • MBTILES_SERVER_CACHE
  • MBTILES_SERVER_PROTOCOL
  • MBTILES_SERVER_PORT
  • MBTILES_SERVER_DOMAIN
  • MBTILES_SERVER_VERBOSE

Docker

A Dockerfile is provided for easy Docker deployment

$ docker build -t mbtiles-server .
$ docker run --rm -it \
  -p 5000:5000 \
  -v ~/mbtiles/:/root/mbtiles \
  mbtiles-server

Start containers automatically

https://docs.docker.com/engine/admin/host_integration/

$ docker run -d \
  --name mbtiles-server \
  -p 5000:5000 \
  -v ~/mbtiles/:/root/mbtiles \
  mbtiles-server

WMTS

The goal of providing a WMTS enabled service is to be performance oriented and scalable. Therefore, servers must be able to return tiles quickly. A good way to achieve that is to use locally stored pre-rendered tiles that will not require any image manipulation or geo-processing.

API

Server

Parameters

  • options [string] Server Options
    • options.cache [string] CACHE file path (optional, default ~/mbtiles)
    • options.domain [string] URL Domain (optional, default 'localhost')
    • options.port [string] URL Port (optional, default 5000)

Examples

server({cache: '/Users/mac/mbtiles', port: 5000, verbose: true})
You can’t perform that action at this time.