Giter Club home page Giter Club logo

tessera's Introduction

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.

tessera's People

Contributors

bdon avatar bwhtmn avatar dependabot[bot] avatar hannesj avatar ianhuynh avatar imran-5 avatar indus avatar mojodna avatar petrsloup avatar ramunasd avatar rsenergy avatar stepankuzmin avatar stevage 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

tessera's Issues

Discover / register tilelive modules

Adding them as optional dependencies won't really work long-term (or with less common variants). npm can be queried to see what's installed, but then how does one determine that it's a tilelive module?

Upon start up, tessera spends several minutes at 100% CPU before returning anything

I have ported the openstreetmap-carto style to vector tiles, and use tessera to serve it. I have pre-generated the vector tiles with tilelive-copy. I'm serving these over http. I'm using tessera to apply the osm-carto style to those vector tiles.

And when I start tessera, and hit a URL for the map JS page, or an individual tile, I get mapnik log messages about depreciated min/maxzoom. And then tessera sits there for a long time (20 minutes?), at 100% of one CPU core, before it returns anything. Once it's gotten over this initial CPU thing, raster tile images are generated in a sensibly quick, snappy, manner. It's just the first tile that takes about 30 minutes.

From looking at the http request logs of the vector tiles, tessera is loading the tilejson file, and nothing else. So it's not loading the actual vector tiles files (ie the MVT pbf's).

What's going on? Why does it take so long to initialize? How can I debug this? stracing the process just shows futex stuff, so I presume it's doing all the things in Javascript.

Unable to use two layers in project.yml

I have two custom layers saved in pbf mbtiles. Everything is working fine if I use a single layer:
source: "mbtiles:/home/data/a.mbtiles"

However, when I try to use two layers, I got the following error message:
source: "mbtiles:/home/data/a.mbtiles,mbtiles:/home/data/b.mbtiles"
Error: SQLITE_CANTOPEN: unable to open database file

I tried several writing:
source: "mbtiles:/home/data/a.mbtiles,/home/data/b.mbtiles"
source: "mbtiles:/home/data/a.mbtiles,home/data/b.mbtiles"

But I always got the error. When I use "mbtiles:/home/data/a.mbtiles,b.mbtiles",
I got no error but nothing is loaded so my tiles are empty.

I am not sure if this is an issue or simply a wrong notation in the project.yml.

Serving mbtiles, tiles all black

I'm trying to serve up mbtiles via: tessera mbtiles://./0-8z.mbtiles

I was trying to verify the tiles were created correctly (using the tl tool, but that might be a different issue)

The tessera script puked when a tile was fetched, throwing this error for each tile request:

SOLVED: Missing xray

GET /_/4/7/7.png 500 1.212 ms - 1231
Error: Invalid tilesource protocol: xray+mbtiles:
    at Object.tilelive.load (/usr/local/lib/node_modules/tilelive/lib/tilelive.js:92:25)
    at /usr/local/lib/node_modules/tessera/node_modules/tilelive-cache/index.js:128:23
    at lock (/usr/local/lib/node_modules/tessera/node_modules/tilelive-cache/node_modules/locking-cache/index.js:57:16)
    at Object.<anonymous> (/usr/local/lib/node_modules/tessera/node_modules/tilelive-cache/index.js:127:12)
    at Object.load (/usr/local/lib/node_modules/tessera/node_modules/tilelive-cache/node_modules/locking-cache/index.js:85:17)
    at /usr/local/lib/node_modules/tessera/lib/app.js:136:21
    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/tessera/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/local/lib/node_modules/tessera/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/usr/local/lib/node_modules/tessera/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/tessera/node_modules/express/lib/router/layer.js:95:5)

Versions of things:

$ npm ls -g mapnik
/usr/local/lib
└── [email protected] 

$ npm ls -g tessera
/usr/local/lib
└── [email protected] 

$ npm ls -g | grep tilelive
│ ├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
├─┬ [email protected]
├─┬ [email protected]
├── [email protected]
├─┬ [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
├─┬ [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ ├── [email protected]
│ └─┬ [email protected]
├─┬ [email protected]

I still have a problem however, all the generated tiles are black! This was working a while ago, there are so many dependencies however I'm not sure what has changed. The tiles are returned are fine and there are no errors:

GET /_/3/5/1.png 200 38.263 ms - 103

Any thoughts? Thanks.

Serve UTFGrids

Is it possible to serve dynamically created UTFGrids using Tessera? I have a tm2style generated with Mapbox Studio. I have set the interactivity_layer, interactivity_fields and template fields in my project.yml and project.xml files. I've also prefixed my source "utfgrid+tmstyle:///path/to/tm2/". The PNG tiles are being served correctly, but I can't figure out how to access the UTFGrid, or if it is even possible using Tessera. Any pointers in the right direction would be greatly helpful. Thanks!

404s include upstream headers (which make them invalid)

I'm using Tessera as a web server for Mapbox vector tiles tiles generated from a shapefile using tilelive-bridge. Tessera throws 404 errors when requesting tiles with no geometry. What is the best way to suppress these 404 errors (so that the client doesn't keep trying to download these tiles and so the broswer debugger isn't filled with 404s)?

I've thought of 2 ways, but I'm not sure if there is a better way:

  • Make a new tilelive module that calls tilelive-bridge functions, but returns an empty tile instead of null if there is no geometry but the tile is still within the bbox
  • Modify Tessera to return empty tile on an error from source if the tile is within the source bbox

Multi-threaded/multi-process serving?

I've started looking into tessera and it seems really cool. As someone with no nodejs experience, I like how I can just call it on the command line without having to programme things in nodejs.

However, from what I can see, tessera only runs single threaded/single process. It doesn't appear to be able to handle more than one incoming request at a time. I found this out by running apache bench (ab) against a tessera server with 100 concurrent requests, and only saw one CPU-worth of processing in my htop.

Is it possible to run tessera in a multi-threaded/multi-process way?

Cannot accept empty buffer as protobuf

I got this error message with the last v0.6 version when I zoom on some parts of my map:

/usr/local/lib/node_modules/tilelive-merge/index.js:129
vt.setData(buf);
^
Error: cannot accept empty buffer as protobuf
at Error (native)
at /usr/local/lib/node_modules/tilelive-merge/index.js:129:16
at fn (/usr/local/lib/node_modules/tilelive-merge/node_modules/async/lib/async.js:638:34)
at Immediate._onImmediate (/usr/local/lib/node_modules/tilelive-merge/node_modules/async/lib/async.js:554:34)
at processImmediate as _immediateCallback

Does not work with tmstyle project that works with kosmtik

I am trying to "port" the openstreetmap-carto style to vector tiles, and I've quickly hacked something together so that that repo can act as a tm2source and a tmstyle. I can serve the pbf tiles with tessera, or generate a mbtiles with tl (and serve that mbtiles with tessera too).

The style can be loaded and viewed when using kosmtik, but not when using tessera.

Getting this error when I try to use it.

$ tessera -p 8081 tmstyle://./
Listening at http://0.0.0.0:8081/

/usr/lib/node_modules/tilelive-tmstyle/node_modules/async/lib/async.js:51
        if (arr.map) {
               ^
TypeError: Cannot read property 'map' of undefined
    at _map (/usr/lib/node_modules/tilelive-tmstyle/node_modules/async/lib/async.js:51:16)
    at _asyncMap (/usr/lib/node_modules/tilelive-tmstyle/node_modules/async/lib/async.js:234:15)
    at Object.map (/usr/lib/node_modules/tilelive-tmstyle/node_modules/async/lib/async.js:216:23)
    at /usr/lib/node_modules/tilelive-tmstyle/index.js:90:18
    at fs.js:266:14
    at /usr/lib/node_modules/tilelive-vector/node_modules/tar/node_modules/fstream/node_modules/graceful-fs/graceful-fs.js:43:10
    at Object.oncomplete (fs.js:107:15)

Tessera leaks memory when converting vector tiles into raster tiles

I'm currently trying to serve raster tiles based off MapBox-formatted vector tiles, but after a while tessera crashes with the following:

GET /hsl-map/13/4661/2372.png 200 1362.108 ms - 2521
GET /hsl-map/13/4660/2372.png 200 1119.578 ms - 2209
GET /hsl-map/13/4666/2372.png 200 1261.209 ms - 5300
GET /hsl-map/13/4665/2372.png 200 1324.336 ms - 7149
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Aborted (core dumped)

I'm running on 64-bit Debian Jessie with node 0.12. The TileJSON for the source can be found at http://tile3.kartat.kapsi.fi/mapbox/index.json and the style is https://github.com/HSLdevcom/openjourneyplanner-map. Am I missing some options for node to increase the memory limits, or might some component be leaking memory?

Implement sinks

The will allow tilelive sinks to be wired up and written to when tiles are rendered.

Depend on local leaflet JS

...to facilitate offline work. gmaps and jquery aren't necessary, as they power the currently non-functional geocoder widget.

Connection closed/aborted errors for requests for vector tiles that take a long time to generate

I have a tmsource project and I'm using tessera to serve the vector tiles from it. This tmsource project uses a lot of PostgreSQL queries that take a long time to run. And when my http client requests a vector tile from tessera it can fail with a http connection aborted / connection closed error. The tessera output shows: GET /pbfs/live//14/7794/3493.pbf - - ms - -.

Is there anyway to make tessera not timeout, and to wait a long time before "giving up". This way, I'd get my vector tiles, even if they take a long time.

In the long run, we need to improve our SQL queries, but we're curring using tessera to generate vector tiles in a batch manner, so waiting a long time is not a big problem.

serve multi datasource in a directory

for tessera now ,it only serves datasource in the config file or datasource specified when we start server, i think if i can config a directory which contains many datasource then i can dynamic copy datasource into the directory would make tessera more powerful.

Protobufs are served up with a Content-Type of `undefined`

$ curl -I http://localhost:8080/6/21/30.vector.pbf
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
X-Powered-By: Express
Content-Type: undefined
Last-Modified: Wed, 26 Feb 2014 19:43:30 GMT
ETag: 12653761536-1393443810000
Content-Length: 77913
X-Response-Time: 3ms
Date: Thu, 27 Feb 2014 21:42:32 GMT
Connection: keep-alive

can't use tm2z files?

Hi - in mapbox studio, I seem to only have the option of exporting a tm2z package (which I assume is just a compressed folder), though most documentation I've read around using tessera revolves around a tm2 file (or mbtiles). When I attempt to use this in tessera:

tessera tmstyle:///vagrant/mblight.tm2z

I get the following:

Listening at http://0.0.0.0:8080/

/usr/local/lib/node_modules/tessera/server.js:43
        throw err;
              ^
Error: ENOTDIR, open '/vagrant/mblight.tm2z/project.yml'

Is this an issue with the file format, or am I doing something else wrong. Note that I'm trying to use tessera in conjunction with this

which I found via this article

Should PBFs return 404s?

Usually zero length response with status 200 and application/x-protobuf is returned in other services when vector tile is completely empty. Tessera returns 404 without any headers.

use osmbright for mbtiles

I'm sure this is the wrong place to ask questions. But how can I server file.mbtiles with the osmbright style. I've modified the osmbright.tms/project.yml source to be source:./../file.mbtiles and serve the tmstyle://./osmbright.tm2 it serves my mbtiles file successfully but it still turns out as xray styling.

Issue with tilelive modules and v6.0

I just installed the v0.6.0 and now my system crashes when rendering the tiles, everything was working smoothly with previous version 0.5.3.

I use several tilelive modules (tmstyle, merge, mapbox, etc..). I also re-installed all these modules but the issue is still there. Any idea ?

Here are the message log when I launch tessera:
GET / 304 9.447 ms - -
GET /leaflet/dist/leaflet.css 304 7.333 ms - -
GET /leaflet/dist/leaflet.js 304 6.746 ms - -
GET /zepto/zepto.min.js 304 7.964 ms - -
GET /js/l.control.geosearch.js 304 1.231 ms - -
GET /leaflet-hash/leaflet-hash.js 304 5.506 ms - -
GET /js/l.geosearch.provider.nominatim.js 304 2.791 ms - -
GET /css/l.geosearch.css 304 0.539 ms - -
GET /images/transparent.png 304 1.098 ms - -
GET /index.json 304 8.264 ms - -
GET /images/geosearch.png 304 0.526 ms - -
node: symbol lookup error: /usr/local/lib/node_modules/tilelive-vector/node_modules/mapnik/lib/binding/node-v14-linux-x64/mapnik.node: undefined symbol: ZN6icu_5513UnicodeStringC1ERKS0

Better UTFGrid handling

  • add tilelive-carto support to tilelive-utfgrid
  • add a grid (or something else, like alternates) key alongside source so that UTFGrid output can sit alongside images (this may be a better, non-magical way to handle retina tiles and multiple formats)

Support overzoom

I'm displaying vector tiles from a OSM mbtiles country extract using MapboxGL that has data up to zoom level 14. When I overzoom past the supported zoom level then I just see a blank map. Tessera is returning empty tiles rather than a '404 tile not found'.

It would be great if Tessera could respond with a 404 instead because this would allow you to zoom all the way in (albeit with reduced resolution).

Wrong tiles URL under Windows

Hi,

I am using tessera under Windows. I use it to serve local source file like this:

> tessera tmsource:\\.\sofia-source.tm2source --p 8500

In Mapbox Studio I specify the tilejson url generated by Tessera:

http://localhost:8500/index.json

At this point, I can see Mapbox Studio calling Tessera, however the tile url has an additional / so it always ends in 404 error:

GET //14/8205/8173.pbf 404 1.314 ms - 30
GET //14/8206/8173.pbf 404 1.998 ms - 30

I believe the reason for this behavior is the url of the tiles. It is:

"tiles":["http://localhost:8500\\\\{z}\\{x}\\{y}.pbf"]

while it should be:

"tiles":["http://localhost:8500/{z}/{x}/{y}.pbf""]

I can fix the problem If I remove the use of Path.normalize from the callback that generates index.json in app.js:

        var uri = "http://" + req.headers.host +
                                   tilePath.replace("{format}",
                                          getExtension(info.format));

Regards,
Kiril

problem using the served map within mapbox js api

Hi - I've got tessera up and running, and can view the map by pointing my browser to:

http://localhost:8080/#11/37.389/-122.0684

which is really great! I'm just not sure how to use it in production code. When I attempt to replace my mapbox hosted URL in the javascript:

map = L.mapbox.map('map', 'heaversm.b8aa0d0a',{

with the url from tessera:

map = L.mapbox.map('map', 'http://localhost:8080',{ 

I get an html error:

Uncaught SyntaxError: Unexpected token <

How do I use the tessera-served map in mapbox js?

symbol lookup error node.mapnik

hi, appologies if this is the wrong place to ask this: I have an error which I can't figure out.

I installed tessera and started serving a tilemill 2 style. This worked great.

Then since the second time I tried starting tessera, it starts up, but when I load localhost:8080 in a browser it crashes with the following error, with the console output that comes before:

GET / 200 30ms - 1.9kb
GET /css/leaflet-0.7.2.css 200 36ms - 9.92kb
GET /css/l.geosearch.css 200 2ms - 1.16kb
GET /js/leaflet-hash.js 200 48ms - 3.38kb
GET /js/leaflet-0.7.2.js 200 48ms - 122.27kb
GET /js/zepto.min.js 200 51ms - 24.06kb
GET /js/l.control.geosearch.js 200 68ms - 5.11kb
GET /js/l.geosearch.provider.google.js 200 74ms - 1.59kb
GET /images/transparent.png 200 16ms - 951b
GET /index.json 200 5ms - 488b
GET /images/geosearch.png 200 84ms - 699b

node: symbol lookup error: /usr/local/lib/node_modules/tessera/node_modules/mapnik/lib/binding/mapnik.node: undefined symbol: _ZNK6icu_5313UnicodeString10doHashCodeEv

I've tried uninstalling and reinstalling various node modules, including forceful delete, but I don't know enough about nodejs to really know what I'm doing there. The only things I can remember doing since tessera was working:

  • install PIL via apt-get
  • install tilestache in a virtualenv
  • modify the cartocss in the tilemill 2 project (though the crash happens with all styles)

My guess would be that I'm missing a dependency or have a wrong version or something, but I can't figure out what happened to break it.

Any ideas?

Serving MBTiles for Mapbox Studio

Tessera is an amazing piece of work!! Great how you managed to make it so easy to run a server
for different tilelive-sources.

What I would like to use Tessera for is to serve an mbtiles file to Mapbox Studio (because it can only work with TileJSON urls no mbtiles).

When specifying the TileJSON endpoint in Mapbox Studio something is not right with the X-Y axis or projection. The map is like tiled into several pieces.

Reproduce:

Using the following MBTiles.
https://github.com/klokantech/vector-tiles-sample/releases/download/v1.0/countries.mbtiles

tessera -p 80 mbtiles://./countries.mbtiles

Visiting localhost:80 everything works fine.

localhost__2_21_1_369_7

Clone repo https://github.com/klokantech/vector-tiles-sample/
If we open the project and swap out the source with the TileJSON source it starts getting weird.

mapbox_studio_classic

Now if we look at the debug view inside the studio it look like the x tiles are at the wrong location.

mapbox_studio_classic

mapbox_studio_classic

Example config file broken?

Literally just copying and pasting the example config in the README:

  "/": {
     ^
SyntaxError: Unexpected token :
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at module.exports (/usr/lib/node_modules/tessera/server.js:61:18)
    at Object.<anonymous> (/usr/lib/node_modules/tessera/bin/tessera.js:70:30)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

Server.js is missing from NPM package

For some reason server.js is not bundled in http://registry.npmjs.org/tessera/-/tessera-0.7.0.tgz

This causes the following issue when trying to run:

data:    node_modules/tessera/bin/tessera.js:37 - module.js:340
data:    node_modules/tessera/bin/tessera.js:37 -     throw err;
data:    node_modules/tessera/bin/tessera.js:37 -     ^
data:    node_modules/tessera/bin/tessera.js:37 - Error: Cannot find module '../server'
data:    node_modules/tessera/bin/tessera.js:37 -     at Function.Module._resolveFilename (module.js:338:15)
data:    node_modules/tessera/bin/tessera.js:37 -     at Function.Module._load (module.js:289:25)
data:    node_modules/tessera/bin/tessera.js:37 -     at Module.require (module.js:366:17)
data:    node_modules/tessera/bin/tessera.js:37 -     at require (module.js:385:17)
data:    node_modules/tessera/bin/tessera.js:37 -     at Object.<anonymous> (/home/reittiopas/docker/map-server/node_modules/tessera/bin/tessera.js:70:10)
data:    node_modules/tessera/bin/tessera.js:37 -     at Module._compile (module.js:435:26)
data:    node_modules/tessera/bin/tessera.js:37 -     at Object.Module._extensions..js (module.js:442:10)
data:    node_modules/tessera/bin/tessera.js:37 -     at Module.load (module.js:356:32)
data:    node_modules/tessera/bin/tessera.js:37 -     at Function.Module._load (module.js:313:12)
data:    node_modules/tessera/bin/tessera.js:37 -     at Function.Module.runMain (module.js:467:10)

"Invalid index file" for shapefiles

Using tilelive-carto on a map style that uses these shapefiles :
http://tile.openstreetmap.org/processed_p.tar.bz2
http://tile.openstreetmap.org/shoreline_300.tar.bz2
http://tile.openstreetmap.org/world_boundaries-spherical.tgz
tessera returns "Error: Invalid index file". After determining that the error was related to shapefiles by tracking down the message origin in mapnik's shape.input file, I was able to resolve it by removing the .index files.

This is most likely an issue with mapnik itself, but a more detailed description of the issue would be needed before reporting there. I have attached a small TillMill project that demonstrates the issue. Run the get-shapefiles.sh script before loading with tessera.

TesseraDebug.zip

Need a way to handle cache control headers for rasters rendered from overzoomed vectors

What I'm doing:
I've got a set of vector tiles that goes to zoom 14, and render rasters using tilelive-tmstyle up to zoom 20. Im using a "Surrogate-Keys" header to enable invalidating rasters from a CDN when one of the vector tiles is updated, using https://github.com/trailbehind/tilelive-expire-fastly/

Example entry from my config.json:

    "/feet-raster": {
        "source": "tmstyle:///home/ubuntu/tm2-projects-private/gaia_topo_feet.tm2/",
        "headers": {
            "Cache-Control": "public,max-age=86400",
            "Surrogate-Control": "max-age=31536000",
            "Surrogate-Keys": "{{#tile}}z{{zoom}}/x{{x}}/y{{y}}{{/tile}}"
        }

The problem:
The raster tile 16/1/2 generates a header of surrogate-keys: z16/x1/y2, but this tile is rendered from the vector tile 14/1/1. When the vector tile 14/1/1 is rendered I invalidate z/14/x1/y1, which properly invalidates the z14 rasters, but not the z15-z20 rasters.

I see 2 possible ways to fix this:

  1. When the z14 vector tile is rendered don't just invalidate 1 key, invalidate keys for all the children of that tile down to z20.
  2. Add new syntax to the header templating to make it so tile 16/1/2 can generate the header surrogate-keys: z14/x1/y1.

I think solution number 1 is clearly a bad idea, and 2 is the correct way to go. Im planning on implementing 2, but if anyone has a better idea of how to handle this i'd be glad to hear it.

The implementation would involve adding an additional context(?) to the params that get passed to populateHeaders in getTile, something like tileMaxZ that at zooms less than or equal to the max contains the same values as tile, but at zooms greater than the max contains the z/x/y values for the tiles parent tile at the max zoom. What this max zoom is would be configurable in the config.json, and the additional values would only be calculated if it was set.

Remove eio dependency

This is currently a top-level dependency because multiple dependents require it and installing it once speeds up installs. However, it looks like it's no longer being depended on, so we can consider removing it.

node-pre-gyp issue

Hi,

I have issues when trying to install tessera or any tilelive module with something called "node-pre-gyp". It seems this is something new, I already installed tessera on multiple servers in the past without problems. Now, when I try to install, for instance the module mbtiles, I received the following error:

npm WARN engine [email protected]: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"2.11.3"})

[email protected] install /root/.nvm/v0.12.7/lib/node_modules/mbtiles/node_modules/sqlite3
node-pre-gyp install --fallback-to-build

sh: node-pre-gyp: command not found
npm ERR! Linux 3.14.32-xxxx-grs-ipv6-64
npm ERR! argv "/root/.nvm/v0.12.7/bin/node" "/root/.nvm/v0.12.7/bin/npm" "install" "-g" "mbtiles"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/npm-debug.log

I have the same issue when trying to install any node linked to mapbox. I tried with different node versions, I got the same message.

I also manually installed node-pre-gyp (npm install -g node-pre-gyp), it works and I can run the program (node-pre-gyp -v > v0.6.26) but I still got the same error (sh: node-pre-gyp: command not found) when I try to install tessera or other mapbox modules.

Any idea ? Thanks

Tessera crashes when loaded as a tile layer into CartoDB?

I think this is what's happening.

I tried to use this URL: http://ec2-54-152-68-8.compute-1.amazonaws.com/richmond/6/34/33.png, converting it into http://ec2-54-152-68-8.compute-1.amazonaws.com/richmond/{z}/{x}/{y}.png for use as a CartoDB basemap. CartoDB gives me message that it can't validate the url, but I think that's because tessera has just crashed. Tessera says this:

GET /richmond/0/0 404 1.629 ms - 25
GET /richmond/0/0/ 404 1.003 ms - 26
GET /richmond/0/0/%7B 404 1.504 ms - 29
GET /richmond/0/0/%7By 404 1.112 ms - 30
GET /richmond/0/0/0 404 1.045 ms - 27
GET /richmond/0/0/0. 404 1.283 ms - 28
Invalid format 'p', expected 'png'
GET /richmond/0/0/0.p 404 1.712 ms - -

crypto.js:240
  this._binding.update(data, encoding);
                ^
TypeError: Not a string or buffer
    at Hash.update (crypto.js:240:17)
    at md5sum (/home/ubuntu/src/openterrain-map/node_modules/tessera/lib/app.js:39:8)
    at /home/ubuntu/src/openterrain-map/node_modules/tessera/lib/app.js:191:38
    at Object._onImmediate (/home/ubuntu/src/openterrain-map/node_modules/tessera/node_modules/tilelive-cache/node_modules/locking-cache/index.js:74:25)
    at processImmediate [as _immediateCallback] (timers.js:354:15)

It looks like the 0/0/0 requests are the probing by CartoDB?

How can I clean current cache?

I replace the old .mbtiles file with new .mbtiles with only properties update. Then I restart tessera, but it is still sending the old itle with outdated properties to the front-end. I guess it's because of the caching, so how can I delete or disable the caching of tessera?

Can't find FontSet

I'm using Mapbox Studio to create the TM2 file, however it doesn't seem to recognize the FontSet.

Another related discussion about this error can be found here, but no working solution. It seems to be resolved on the Mapnik side of things, but not Tessera.

mapnik/node-mapnik#263

$ tessera tmstyle://./Style.tm2

Listening at http://0.0.0.0:8080/

/usr/local/lib/node_modules/tessera/server.js:47
        throw err;
              ^
Error: Failed to find font face 'Open Sans Bold' in FontSet 'fontset-0' in FontSet

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.