Giter VIP home page Giter VIP logo

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

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tilestream's Issues

Small iPad fixes

With some minor adjustments, the TileStream UI could look great on the iPad in portrait and landscape modes. Even if the maps don't work, it'll be great to be able to download tilesets to the iPad app.

checkerboard pattern versus white for null tile

In TileMill, areas without data draw with the grey themed checkerboard pattern. In TileStream they draw white. It's hard to determine where the real tiles end and begin with a white background. Would be nice to use the same UX between the apps.

Can't Install

I keep running into errors on installation. I've tried clean installs of Ubuntu 10.10 and 11.04. I've tried with and without TileMill. Both throw up errors (more so than usual) during the installation process (sorry- I didn't record them. If I can find the time, I'll repeat the process and record the error messages). When I attempt to rule TileStream, I get the following error messages in the terminal:

node.js:63
throw e;
^
Error: Cannot find module 'optimist'
at loadModule (node.js:275:15)
at require (node.js:411:14)
at Object. (/home/terry/tilestream/bin/tilestream:3:12)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)
at Module.loadSync (node.js:338:12)
at Object.runMain (node.js:522:24)
at Array. (node.js:756:12)
at EventEmitter._tickCallback (node.js:55:22)
at node.js:773:9

I've pretty much retraced steps that were successful before, so I think there may be a problem at this end. Any help would be greatly appreciated.

  • Terry

Clicking mbtiles yields "no baselayer set" error

Working off today's build (fresh pull), I've loaded the Honshu quake tiles into the ../tiles directory along with World Light. I can click World Light and open them fine, but when I click the Honshu tiles (here's what I see before I click: https://img.skitch.com/20110311-jax8eps6qa9krdjtaux26urk9u.jpg), I next see this error: https://img.skitch.com/20110311-kt4ew333per1iux71ks3rk4c3m.jpg. Note the URL, it says I'm on the Honshu page.

When I was seeing the error, I tried to go into settings.js to edit the default baselayer and here's what I've set it to. Stopped and restarted the app and still nothing:

module.exports = { 'port': 9000, 'UIPort': 9000, 'tile_hostnames': [], 'default_baselayer': '/tiles/World_Light.mbtiles', 'tiles': __dirname + '/tiles',

Zoom in a bit to get the preview tile

The lowest zoomlevel is rarely the best one to use for a preview. I would recommend choosing a tile from a zoomlevel that is 30-50% zoomed in on the available range of the tileset.

If we want to get super fancy we could base the preview tile location on popularity from the logs :P

Switch to Modest Maps

Let's do this.

  1. Integrate MM into TileStream wax API.
  2. Alias the old ol API key to mm and ensure that it still works even with requests asking for ol.
  3. Nuke OpenLayers code.

Remove syslogd support

@kkaefer, is the syslogd support still necessary or is the recommended approach to log to a text file and use another tool to push to syslog? I remember the concern was that a log entry writing could be interrupted as the application crashes.

options.tilePort not respected

As noted at #30 (comment) it appears that if the tilePort if different from the UI port the tiles still are only available at the uiPort - so the 'tilePort' config appears to be ignored.

Allow users to rename maps

Can we implement a function to rename maps through the UI? Ideally, this would not affect the url or existing embeds of the map.

./ndistro doesnt respond

When I run ./ndistro in the Tile Stream Directory nothing happens. Is there a file missing from here?

Bad Request error

Followed the instructions for Ubuntu 10.10 for v0.2.0., but when I try to access the Tilestream server, I get an error message: "Bad Request". Do you have any ideas on how to debug this? I tried running ./index.js start --accesslog but nothing is printed to the console.

TileStream install guide tweeks (Ubuntu)

These comments from a friend who installed TileStream and ran into some Ubuntu ambiguity over where to download and install the apps, provide more inline explanation, getting the right version of required dependences (that are out of synch with the latest version) and setting some permissions.

_n

  1. Install build requirements:
    sudo apt-get install curl build-essential libssl-dev libsqlite3-0 libsqlite3-dev

  2. Install node and nmp

    Prerequisites: Git and OpenSSL

    sudo apt-get updatesudo apt-get install git-core
    sudo apt-get install build-essential openssl libssl-dev

    use Git to install the latest version of Node.js

    git clone https://github.com/joyent/node.git && cd node

    Get the required version for tilestream

    git checkout v0.4.7
    ./configure
    make
    sudo make install

    test the version

    node -v

    to install NPM you will need to install curl

    sudo apt-get install curl

    don’t use sudo for the NPM install, just change the permissions to the /usr/local directory so that the installer can do its thing

    sudo chown -R $USER /usr/local
    curl http://npmjs.org/install.sh | sh

  3. Download and unpack TileStream. Build & install:
    cd /opt
    sudo git clone git://github.com/mapbox/tilestream.git
    cd tilestream
    sudo npm install

  4. Start TileStream:
    sudo ./index.js

Auto Startup

Just downloaded Tilestream and having great fun playing.

I'm afraid I'm a bit of a noob when it comes to scripting and Terminal. Is there an easy way to have the Tilestream service start automatically on machine boot up (or login); I'm assuming it's some sort of bash issue, but the world 'bash' alone has me running for cover. Is there something I can put in .bashrc to help out?

BTW - using an OSX system

Subsequent calls to window.tsEmbed.init() fail

I'm embedding and removing the same map multiple times. While the first attempt succeeds, subsequent attempts fail. (At any given point there is either one map or no map attached to the DOM).

I found that deleting window.tsEmbed before adding in the embed code fixes the issue:

if (window.tsEmbed) delete window.tsEmbed;

I suspect that some portion of tsEmbed is not designed to be executed multiple times.

Build error - missing SConscript

I just built Tilestream from HEAD and ran ndistro, it got stuck during the process and showed this error:

scons: warning: Ignoring missing SConscript 'obj/test/release/SConscript'
File "/Users/cairnsim/Projects/tilestream/src/node-0.2.6/deps/v8/SConstruct", line 1097, in BuildSpecific

Always use JSONP for grid, formatter, and legend endpoints

CloudFront does not support query string parameters so we can't rely on Express being able to determine the proper jsonp callback to use. We need make assumptions and hardcode this so express always uses the same callback.

The best approach might be to massage the query in the request object.

URL-based cache versioning mechanism

As discussed with @tmcw we may want to include a short hash in tile URLs that indicate the "version" or cksum of a tileset at a given point in time, allowing it to be updated and automatically have a new version URL.

API data needed for tile hostname

The API currently doesn't indicate the tile hostname/URL base for a given layer. iPad needs this to make the connection between a layer and actually pulling its map data.

Instance of mbtiles is kept around

tilestream somewhere keeps a reference to an mbtiles object (which in turn contains a database reference) around. Due to that, tilestream always keeps one database handle open.

I did some research and it looks like it's in model-server.js, probably a reference to the object is kept somewhere in backbone's call stack.

tilestream local install with drupal local install

Hi,

I have tilemill installed and it is running smooth. I have installed Tilestream also and I can view my exported tiles perfectly. I am trying to use the map though using tilestream on the local machine with Drupal openlyers but despite following the instructions on

http://support.mapbox.com/kb/tilestream/using-tilestream-with-drupal

I dont see a map. I can see other maptiles from internet without problem but nothing from my localhost.
Meanwhile I noticed the below in the tilestream terminal window... I installed the mapnik2, tilemill 0.3.2 and now tilestream 3 days ago. Why would the below then be missing? or are they just not activated and I did something wrong? is the below the reason I cant use them in Durpal or is something else wrong.

mats@ubuntu:~/tilestream$ bin/node bin/tilestream
DEBUG: tilelive.js: node-get not found.
DEBUG: tilelive.js: mapnik not found.
DEBUG: tilelive.js: carto not found.
DEBUG: tilelive.js: mapnik not found.
Loading tilesets...
5 Jun 17:45:50 - Starting TileStream.
Started server on port 8888.

tnx

Review HTTP status codes and headers

To use this server effectively in conjunction with nginx, CloudFront, or another CDN, we should do a review of the HTTP codes and headers we are returning with tiles to make sure they are optimal.

For me, the biggest questions are the Last Modified and Etag headers.

Tiles attempt loading from 127.0.0.1 -- no obvious hostname config

I booted up tilestream at:

http://tilestream.publiclaboratory.org/

and at first, one tileset worked and one showed up grey. Now both are failing to load, and I'm getting "Failed to load resource: Could not connect to the server." for 8.png,

I realized it's requesting them from 127.0.0.1, not tilestream.publiclaboratory.org. I tried grepping around but couldn't find either an obvious place to change 127.0.0.1 or instructions or examples on the config JSON file ... also i noticed "localhost" was hardcoded in many places, though i imagine that's just internal references between the ui server and other parts.

This is probably a really minor thing but could someone post an example config JSON file? that ought to clear things up. And/or providing for a host as a commandline flag.

Thanks! Great stuff.

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.