• Stars
    star
    736
  • Rank 61,564 (Top 2 %)
  • Language
    JavaScript
  • License
    BSD 3-Clause "New...
  • Created almost 14 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A high-performance map tile server powered by MBTiles files

TileStream

TileStream is a high-performance map tile server powered by MBTiles.

It's like TileCache, TileStache, and other map servers in that it serves normal image files that can be used in OpenLayers, Google Maps, Modest Maps, and other Javascript APIs without much trouble - and with lots of enhancements when you use Mapbox.js.

It's not like those tile servers in that it doesn't yet generate maps, it only serves maps that are generated with TileMill. This means that it's reliably fast but not designed to serve live data.

MapBox Hosting uses the same internals as TileStream but adds many features and is a hosted service rather than an installable application.

Features

  • MBTiles-based tile server
  • Minimal gallery view and map viewer for tiles
  • Support for MBTiles interaction using Mapbox.js

Requirements

  • Node.js v0.10.x or v0.8.x

After installing Node.js you can should have the npm command.

Installation

You can use npm to install TileStream:

git clone https://github.com/mapbox/tilestream.git
cd tilestream
npm install

Start TileStream:

./index.js

Get options:

./index.js start --help

TileStream should now be accessible from a browser at http://localhost:8888.

Installation note: OS X

Installing Node.js via Homebrew (brew install node), the PKG installer, or nvm are all good ways to install Node.js.

Installation note: Ubuntu

If installing on ubuntu we recommend installing Node.js via the chris-lea PPA:

sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs nodejs-dev npm

Usage

Start TileStream:

./index.js start

Get options:

./index.js start --help

If something goes wrong during the install you can do a complete install by doing

rm -rf node_modules
npm install

Some handy options::

./index.js start --uiPort=[80] --tilePort=[80] --tiles=/usr/share/tilestream

The above example specifies custom ports for the user interface and the tile store, and also demonstrates how to specify a directory other than ~/Documents/MapBox/tiles for the mbtiles directory.

Custom configuration

If you intend to run TileStream as a server on a hostname or an IP rather than as localhost, specify that hostname when you run TileStream:

tilestream --host 127.0.0.1
tilestream --host yourhost.com

In these examples, you would only be able to access tilestream from 127.0.0.1 or yourhost.com, respectively, due to security restrictions.

You can also specify the hostname TileStream should use for URLs in its responses by setting a custom tileHost value:

tilestream --tileHost yourhost.com
./index.js start --tileHost="yourhost.com"

This is useful if you want to sit your TileStream server behind a proxy (such as nginx) and restrict direct access to TileStream:

tilestream --tileHost yourhost.com --host 127.0.0.1
./index.js start --tileHost="yourhost.com" --host="127.0.0.1"

These configuration flags can also be set using a JSON file:

./index.js start --config config.json

Where config.json is something like:

{
  "host": ["127.0.0.1"],
  "tileHost": "yourhost.com",
  "tilePort": 8888,
  "uiPort": 8888
}

Configuration

MBTiles files should be placed in the ~/Documents/MapBox/tiles directory, which is created at first run. Each tileset can be previewed at http://localhost:8888/map/[filename] where [filename] is the name of the tileset file without the .mbtiles extension.

Tileset filenames:

  • May contain letters (lower or upper case), numbers, underscores or dashes.

      world-light.mbtiles
      control_room.mbtiles
      PartyLikeIts1999.mbtiles
    
  • May not contain periods, spaces, non ASCII characters or other punctuation.

      World Light.mbtiles
      BlueWorld-1.0.mbtiles
    

To see the options available for use with TileStream, run

./index.js start --help

Tests

TileStream tests use Expresso.

cd tilestream
npm install expresso
npm test

Deployment

See the configuration_examples directory for configuration examples with nginx and upstart.

Troubleshooting

If you run into problems during install, such as unfound dependent versions, first try deleting the node_modules/ folder and re-run node install. It seems that some errors leave the installation in an unclean state (for example if you accidentally switched node versions during the install in the hopes of making things work!).

Build Failures

npm install may cause:

Waf: Leaving directory '/Users/sundar/Projects/tilestream/node_modules/sqlite3/build'
Build failed:
-> task failed (err #1):
{task: cxx statement.cc -> statement_1.o}
-> task failed (err #1):
{task: cxx database.cc -> database_1.o}
-> task failed (err #1):
{task: cxx sqlite3.cc -> sqlite3_1.o}
npm ERR! [email protected] preinstall: `node-waf clean || (exit 0); node-waf configure build`
npm ERR! `sh "-c" "node-waf clean || (exit 0); node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.

Manually installing sqlite3 via npm install sqlite3 resolved this issue. Then re-run npm install in the tilestream folder:

npm install sqlite3
npm install

If you STILL get errors when launching index.js, there may be more modules to install manually. This is the list that worked for me:

npm install sqlite3
npm install mbtiles
npm install jsdom
npm install uglify-js
npm install connect
npm install qs
npm install mime

But again, all this headache may be solved by just deleting your node_modules/ folder and re-running npm install.

Contributors

More Repositories

1

team-directory

A rolodex for teams
JavaScript
110
star
2

tutorial-sherlock

DEPRECATED: The Adventure of the Bruce-Partington Plans
81
star
3

mapbox-gl-cocoa

OBSOLETE
73
star
4

foursquare-store-locator

DEPRECATED: A template for building a store locator with the foursquare API. Part of the Map Sites templates from MapBox. See https://www.mapbox.com/guides/building-a-store-locator/
JavaScript
62
star
5

easey-DEAD

easing handlers for Modest Maps
JavaScript
62
star
6

dc-properties-template

DEPRECATED: A template for browsing layers of TileMill maps. Part of the Map Sites templates from MapBox.
CSS
62
star
7

dev-documentation

documentation development tool
JavaScript
55
star
8

live-tweets-template

deprecated / nonfunctional
CSS
54
star
9

backbone-couch

Backbone.js sync for CouchDB
JavaScript
41
star
10

projectmill

Need to generate a bunch of TileMill projects that are nearly identical and then render them all out? Want to script that? We gotcha covered.
JavaScript
32
star
11

glower

Dynamic feature highlighting for MapBox tilesets
JavaScript
32
star
12

node-mapbox-gl-native

DEPRECATED
C++
30
star
13

Mapresent

Interactive map presentation tool for iPad which exports to video
Objective-C
30
star
14

map-site

A template-driven approach to microsites
JavaScript
28
star
15

clustr

DEPRECATED
JavaScript
28
star
16

dat-editor

"alpha"
JavaScript
22
star
17

tilemill_examples

DEPRECATED REPO - goto https://github.com/mapbox/tilemill/tree/master/examples
21
star
18

MapDBImporter

A tool to import a folder of MapBox tiles into a single SQLite file.
Objective-C
18
star
19

markers.js

DEPRECATED: USE MAPBOX.JS
JavaScript
18
star
20

geojson-cover

generates an s2 cover from geojson
JavaScript
16
star
21

tilemill-reference-layer

TileMill Plugin that allows adding a tiled layer from tiles.mapbox.com
JavaScript
15
star
22

image-equal

USE PIXELMATCH INSTEAD
JavaScript
15
star
23

mapsonastick

DEPRECATED: See TileStream and MapBox for iPad
JavaScript
13
star
24

reinventgreen

CSS
13
star
25

documentation-theme-default

default theme for documentation
JavaScript
9
star
26

spots

MapBox Spots β€” Tell stories using maps
JavaScript
9
star
27

millprep

Prepares geographic data for TileMill
Python
9
star
28

tile-stat-stream

generate statistics from vector tile streams
JavaScript
8
star
29

swarm

DEPRECATED A tool for working with swarms of Amazon EC2 servers.
JavaScript
8
star
30

glify

glsl-unit compiler as browserify transform
JavaScript
7
star
31

running-map-example

An example of how to make a running map with open source components.
JavaScript
7
star
32

pbf-sprite-prototype

PROTOTYPE: assemble protocol-buffer encoded sprites
JavaScript
7
star
33

metatip-DEAD

wip / powerful tooltips for leaflet
JavaScript
5
star
34

slippy-colors

A D3 color picker component. It's a color picker...and a slippy map.
JavaScript
5
star
35

MapBoxBench

DEPRECATED MapBox iOS SDK benchmarking tool
Objective-C
5
star
36

react-tag-list-input

An input element for a list of pre-provided tags in React.js.
JavaScript
4
star
37

s3watcher

DEPRECATED Watch an S3 bucket for new objects.
JavaScript
4
star
38

mapbox-gl-style-lint

MOVED: https://github.com/mapbox/mapbox-gl-style-spec
JavaScript
4
star
39

directions-instructions

translate and transform driving directions between languages
JavaScript
4
star
40

carto-to-gl

the future in the past
JavaScript
4
star
41

deadsea

prevent the scrolling-into-elements problem of mapping libraries
JavaScript
3
star
42

tilemill-lots

Dev lots plugin for use with pluggable tilemill branch
JavaScript
3
star
43

react-tangle-compat

A compatibility layer for tangletext on numeric inputs
JavaScript
3
star
44

canvas-linechart

a fast, simple line chart
JavaScript
3
star
45

foursquare-checkins

CSS
2
star
46

tornado-analysis

tornado analysis template
JavaScript
2
star
47

overload

[DEPRECATED] The fastest way to read a ton of GitHub notifications.
JavaScript
2
star
48

tilestream-pkg

TileStream packages for Ubuntu/Debian
Shell
2
star
49

tilemill-browser-preview

A tiny plugin that adds a button to open the map in your default browser.
2
star
50

tilelive-gl

DEPRECATED
JavaScript
2
star
51

loggly-init

Simple node.js script to add/remove a device from Loggly
JavaScript
2
star
52

get-control-points

Barebones method for deriving control points given start, end, and base.
JavaScript
2
star
53

node-tint

Tints paletted grayscale images
JavaScript
2
star
54

canvas-colorchart

JavaScript
1
star
55

lab-interp

JavaScript
1
star
56

2013-oklahoma-tornado

1
star
57

jit_datasource

a just in time datasource for Mapnik
C
1
star
58

palettegen

Generates JSON palettes from tiles
JavaScript
1
star
59

carmen-qs-adm0

DEPRECATED
Shell
1
star
60

cloudwatch-init

cloudwatch-init is DISCONTINUED. The same functionality is now part of cloudwatch-agent
JavaScript
1
star
61

as-replace-instances

DEPRECATED (see README.md)
JavaScript
1
star
62

canvas-linearlinechart

JavaScript
1
star