GithubHelp home page GithubHelp logo

ndrwptrsn / tilestream Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cutting-room-floor/tilestream

0.0 1.0 0.0 4.87 MB

A high-performance map tile server powered by MBTiles files

License: BSD 3-Clause "New" or "Revised" License

CSS 24.60% JavaScript 68.45% Makefile 0.58% Shell 6.36%

tilestream's Introduction

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

tilestream's People

Contributors

kkaefer avatar wrynearson avatar tmcw avatar ianshward avatar makenosound avatar sespindola avatar oeon avatar timlinux avatar dmitrig01 avatar incanus avatar markng avatar stepankuzmin avatar stevage avatar cybertoast avatar

Watchers

James Cloos 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.