• Stars
    star
    322
  • Rank 129,648 (Top 3 %)
  • Language
    JavaScript
  • License
    BSD 2-Clause "Sim...
  • Created almost 11 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

A tilelive-based tile server.

tessera

tessera is a tilelive-based tile server.

Using the power of the tilelive ecosystem, it is capable of serving and rendering tiles from many sources.

Installation

npm install -g tessera
npm install -g <tilelive modules...>

How to Use

tessera does not install tilelive providers itself; it is up to you to (globally) install any modules that you wish to use (along with dependencies present in your configuration; e.g. a TM2 style that loads data tiles from an HTTP source).

Modules listed in tilelive-modules will be auto-detected and loaded if they have been installed. For other modules, you will need to --require them explicitly.

To serve up an MBTiles archive using node-mbtiles:

npm install -g @mapbox/mbtiles
tessera mbtiles://./whatever.mbtiles

Note: If you want to be able to preview vector tiles (MVT/PBF), you need these 2 modules:

npm install -g tilelive-vector tilelive-xray

Note: If you want to render static maps from an endpoint, you'll need to use ~0.13.1, as static map functionality was removed in v0.14.0 to simplify dependencies (see #86 for more context).

To serve up a TileMill (or Carto) project using tilelive-carto:

tessera carto+file://./project.mml

To serve up a TM2 style using tilelive-tmstyle:

tessera tmstyle://./

Note: non-mapbox: sources may need to have their protocols changed; tessera requires that styles using HTTP-accessible data have tilejson+http: as their protocol where TM2 expects http:. See mojodna/tilelive-http#2 for more information.

To serve up a TM2 data source (it will use data.yml as the source of truth) using tilelive-tmsource:

tessera tmsource://./

To serve up a bare Mapnik stylesheet using tilelive-mapnik:

tessera mapnik://./stylesheet.xml

To serve up files from a filesystem using tilelive-file:

tessera file://./tiles

To proxy HTTP-accessible tiles using tilelive-http:

tessera http://tile.stamen.com/toner/{z}/{x}/{y}.png

To proxy Mapbox-hosted tiles using tilelive-mapbox:

tessera mapbox:///mapbox.mapbox-streets-v4

To proxy tiles with available TileJSON using node-tilejson:

tessera tilejson+http://a.tiles.mapbox.com/v3/mapbox.mapbox-streets-v4.json

A TileJSON endpoint is available at /[PATH]/index.json (for instance, localhost:8080/index.json), containing metadata about the tiles being served.

Configuration

Tessera has command-line options:

Usage: node tessera.js [uri] [options]

uri     tilelive URI to serve

Options:
   -C SIZE, --cache-size SIZE          Set the cache size (in MB)  [10]
   -c CONFIG, --config CONFIG          Provide a configuration file or directory
   -p PORT, --port PORT                Set the HTTP Port  [8080]
   -b HOST, --bind HOST                Set interface to listen on [0.0.0.0]
   -m, --multiprocess                  Start multiple processes  [false]
   -P, --processes                     Number of processes to start  [8]
   -r MODULE, --require MODULE         Require a specific tilelive module
   -S SIZE, --source-cache-size SIZE   Set the source cache size (in # of sources)  [10]
   -s SOCKET, --socket SOCKET          Listen on unix socket
   -v, --version                       Show version info

A tilelive URI or configuration file is required.

Commonly used options can be set using the TESSERA_OPTS environment variable.

This is what a configuration file looks like:

{
  "/": {
    "source": "mbtiles:///Users/seth/archive.mbtiles",
    "cors": false,
    "timing": false
  },
  "/a": {
    "source": "mbtiles:///Users/seth/archive.mbtiles",
    "headers": {
      "Cache-Control": "public,max-age={{#tileJSON}}86400{{/tileJSON}}{{#tile}}3600{{/tile}}",
      "Surrogate-Control": "max-age=86400",
      "Surrogate-Keys": "{{#tile}}z{{zoom}} x{{x}} y{{y}}{{/tile}}"
    }
  },
  "/b": "mbtiles:///Users/seth/archive.mbtiles"
}

Header values are treated as Mustache (technically Handlebars) templates, which allow them to vary by request. The following variables are available to header templates:

  • tile.retina - for retina (@2x) requests
  • tile.zoom - zoom (for tile requests)
  • tile.x - row (for tile requests)
  • tile.y - column (for tile requests)
  • tile.format - requested format
  • tileJSON - for TileJSON requests
  • 200 - HTTP 200
  • 404 - HTTP 404
  • invalidFormat - the requested format did not match what the tilelive source provides
  • invalidZoom - the requested zoom is outside the available range
  • invalidCoordinates - the requested coordinates are outside the available bounds

CORS and X-Response-Time can be disabled per-style:

{
  "cors": false,
  "timing": false
}

(Note that enabling for / will propagate to all subdirectories, as they act as middleware.)

Custom tile paths may be set per-style:

{
  "tilePath": "/{z}/{x}/{y}-debug.{format}"
}

The default tile path is:

{
  "tilePath": "/{z}/{x}/{y}.{format}"
}

(Note: the final . will be expanded to transparently support retina requests (effectively /{z}/{x}/{y}@2x.{format}).)

If --config is set to a directory, all JSON files in it will be concatenated together to form a single configuration. In the case of repeated options or paths, the last one will win (where files are loaded in alphabetical order).

For sources that render rasters from vector tiles at and have a max zoom level that is higher than the max zoom level of the vector tiles it can be helpful to have additional variables available for headers that represent the vector tile that a raster was rendered from. This can be enabled with an additional source option in the configuration file:

{
  "sourceMaxZoom": 14
}

This will make three additional values available for header templates:

  • tile.sourceZoom
  • tile.sourceX
  • tile.sourceY

For example: if sourceMaxZoom is set to 14, a request for tile 16/100/100 will set the following variables:

  • tile.sourceZoom = 14
  • tile.sourceX = 25
  • tile.sourceY = 25

Multiprocess mode

By default, tessera runs in a single process (modules, e.g. Mapnik, may use multiple threads). For sources that are CPU intensive to render, or when running on servers with large numbers of CPU cores there can be significant performance improvements from running in multiprocess mode. When multiprocess mode is enabled with the --multiprocess option multiple processes will be started, with each process running a single thread, enabling many requests to be served at once. The number of processes to be started defaults to the number of CPU cores on the host, but can be configured with the --processes option.

Environment Variables

  • PORT - Port to bind to. Defaults to 8080.
  • HOST - Interface to listen on. Defaults to 0.0.0.0 (all).
  • CACHE_SIZE - Cache size (in MB) for tilelive-cache. Defaults to 10MB.
  • SOCKET - Unix socket to bind to. Optional.
  • SOURCE_CACHE_SIZE - Number of sources to cache (for tilelive-cache). Defaults to 6. NOTE: implicit retina versions count as an extra source.
  • TESSERA_OPTS - Additional command-line arguments.

More Repositories

1

metricsd

A metrics aggregator for Graphite
Scala
148
star
2

oauth-proxy

(in-use) An HTTP proxy for signing OAuth requests
Python
143
star
3

switchboard

(formerly-in-use) A toolkit for assembling XMPP clients and interacting with XMPP servers.
Ruby
135
star
4

marblecutter

Dynamic tiling of raster data for OpenAerialMap + others
Python
121
star
5

heroku-buildpack-jemalloc

Heroku buildpack with jemalloc
Shell
116
star
6

marblecutter-virtual

Virtual catalogs for marblecutter
Python
46
star
7

osm2orc

Transcodes OSM PBFs to ORC
Java
46
star
8

tl

An alternate command line interface to tilelive
JavaScript
38
star
9

heroku-buildpack-cairo

Heroku buildpack with Cairo (and Pixman and FreeType)
Makefile
34
star
10

fire-hydrant

(demo) Tools for consuming Fire Eagle's XMPP PubSub feed.
Ruby
32
star
11

osm-pds-pipelines

OSM PDS pipeline
JavaScript
30
star
12

sample-oauth-provider

A sample Rails OAuth provider that doesn't use oauth_plugin (or acts_as_authenticated)
Ruby
26
star
13

active_queue

A toolkit for queueing tasks and creating worker processes
Ruby
20
star
14

oauth-reverse-proxy

(proof-of-concept) A reverse HTTP proxy that verifies signed OAuth requests
Python
18
star
15

linq.js

Git mirror of http://linqjs.codeplex.com/
JavaScript
16
star
16

dovetail

(proof-of-concept) A toolkit for assembling XMPP components.
Ruby
14
star
17

mars

(proof-of-concept) REST over XMPP
Ruby
13
star
18

tilelive-http

An HTTP source for tilelive
JavaScript
12
star
19

marblecutter-tilezen

Python
12
star
20

tilelive-cache

A caching wrapper for tilelive.js
JavaScript
11
star
21

searchable

(formerly-in-use) Annotation-Driven Indexing and Searching with Lucene and Solr
Java
11
star
22

node-oauth-proxy

An HTTP proxy that signs OAuth 1.0a requests
JavaScript
10
star
23

heroku-buildpack-gdal

Heroku buildpack with GDAL
Shell
9
star
24

oauth-signpost

Git mirror of http://code.google.com/p/oauth-signpost/
Java
8
star
25

marblecutter-tools

Tools to process raster data for use with marblecutter
Shell
8
star
26

fireeagle-tutorial

Sample code for using Fire Eagle from Ruby and Python
Python
8
star
27

imap2atom

Create an Atom representation of an IMAP mailbox.
Ruby
7
star
28

marblecutter-openaerialmap

Python
7
star
29

tilelive-merge

A tilelive source that merges sources
JavaScript
7
star
30

placemaker-cli

Command-line interface for Y!'s Placemaker API
7
star
31

tilelive-tmstyle

JavaScript
7
star
32

tilelive-tmsource

A tilelive provider for TM2 sources.
JavaScript
6
star
33

mirror

Mirror SVN repositories to GitHub
Ruby
6
star
34

posm-imagery-api

POSM imagery API
Python
6
star
35

whirlycache

(formerly-in-use) [mirror] A fast, flexible in-process object cache for Java.
6
star
36

sawfish

(incomplete) Barebones Fire Eagle updater for Android
Java
5
star
37

log-nexus

A rebroadcasting syslog server
JavaScript
5
star
38

tilelive-rasterpbf

A tilelive source for outputting PBF-encoded rasters from PostGIS.
JavaScript
5
star
39

tilelive-carto

A Carto style source for tilelive
JavaScript
5
star
40

heroku-buildpack-mapnik

Heroku buildpack with Mapnik and its dependencies
Shell
5
star
41

jupiter

(proof-of-concept) A test bed for ActiveResource over XMPP
5
star
42

bamboo-shooter

(demo) PubSub for Pandas
Ruby
4
star
43

fireeagle-location-provider

Fire Eagle Location Provider for Google Gears
4
star
44

node-jersey

Bridges UDP packets onto the information superhighway.
JavaScript
4
star
45

anemone

Web Hook servicer / batch request system
Ruby
4
star
46

tilelive-xray

tilelive data tile visualization
JavaScript
4
star
47

tp

'tp: putting the tee in HTTP
JavaScript
4
star
48

node-metricsd

metricsd client for Node.js
JavaScript
4
star
49

crud_controller

Abstract resource controller + generator for Rails
4
star
50

tilelive-modules

A listing of known tilelive modules
JavaScript
4
star
51

node-fuse-leveldb

LevelDB-backed FUSE filesystem
JavaScript
4
star
52

geode-held

Geode-HELD + Fire Eagle support
JavaScript
4
star
53

tilelive-raster

tilelive source for simple rasters, both local and remote
JavaScript
4
star
54

planworld.rb

(preliminary) ruby port of Planworld
Ruby
3
star
55

overpass-diff-publisher

Convert Overpass augmented diffs to JSON
JavaScript
3
star
56

osm-replication-streams

OSM replication-related Node.js streams
JavaScript
3
star
57

changeset-replay-tool

JavaScript
3
star
58

lambda-layer-rasterio

Dockerfile
3
star
59

mapshaper-proxy

JavaScript
3
star
60

tilelive-mapbox

A tilelive.js source for mapbox:// URIs
JavaScript
3
star
61

heroku-buildpack-pgsql

Heroku buildpack with PostgreSQL binaries and libraries
Shell
3
star
62

tiled-vector-remix

Mix and match tiled vector layers
JavaScript
3
star
63

gatsby-remark-copy-images

Gatsby Plugin: Copies images referenced from markdown to your `public` folder.
JavaScript
3
star
64

sprout

(formerly-in-use) Annotation-Powered Simplicity for Struts 1.x
Java
3
star
65

tilelive-streaming

Streaming functionality for tilelive modules
JavaScript
3
star
66

mojodna.net

CSS
2
star
67

accelerometer

D3 accelerometer vis + Node websocket server
HTML
2
star
68

vector-tile-wizard

MVT rendering with Dropwizard and Processing
Java
2
star
69

mapnik-styles

(reference, experimental) Mapnik styles
2
star
70

httpclient-oauth

HttpComponent-compatible OAuth client implementation (WIP)
Java
2
star
71

flickr-shape-parser

(utility) Parses and converts the Flickr Shapefiles Public Dataset, Version 1.0
Python
2
star
72

AaronCam

Camera + Flickr app skeleton
Objective-C
2
star
73

mapnik-query-analyzer

Find layer bottlenecks in Mapnik stylesheets
JavaScript
2
star
74

marblecutter-land-cover

Marblecutter-powered land cover data rendering
Python
2
star
75

dji_fc300c

Calibration images for DJI FC300C (Phantom 3 Standard)
2
star
76

tilelive-leveldb

JavaScript
2
star
77

uv_check_sample.node

Node.js addon that demonstrates inconsistent uv_check_* behavior
C++
1
star
78

strava-cli

Strava command line client
JavaScript
1
star
79

firesnake

(demo) Python-powered Google Earth visualizer for Fire Eagle data
Python
1
star
80

node-locking-cache

A locking LRU cache
JavaScript
1
star
81

tilelive-cartodb

A tilelive source for CartoDB
JavaScript
1
star
82

docker-gdal

Curated versions of GDAL as Docker images
Dockerfile
1
star
83

node-strav3

Strava API (v3) client (Node.js)
JavaScript
1
star
84

tilelive-blend

A tilelive provider that blends.
JavaScript
1
star
85

tilelive-csvin

A streaming tilelive source for CSV inputs
JavaScript
1
star
86

node-heroku-runtime-metrics

Consumes Heroku log streams and emits metrics to metricsd
JavaScript
1
star
87

tilelive-null

A noop sink for tilelive
JavaScript
1
star
88

levels

Levels
1
star
89

node-fuse-mbtiles

FUSE filesystem for MBTiles
JavaScript
1
star
90

node-heroku-syslog-metricsd-bridge

A Heroku syslog drain that bridges to metricsd
JavaScript
1
star
91

marblecutter-lambda

Dynamic raster processing on AWS
Python
1
star
92

watercors

River gauge proxy
JavaScript
1
star
93

debian-mapnik

Mirror of git://git.debian.org/pkg-grass/mapnik.git
C++
1
star