More

Node JS and Tilestrata to serve SRTM Tiles

Node JS and Tilestrata to serve SRTM Tiles


I emailed one of the authors and it turns out that tilestrata-disk wasn't meant to be used as a "provider" in their system. No wonder! Here's what Brian Reavis said about how the cache works:

A cache expects tiles to come from somewhere else. It's job is to wrap a tile source (provider) with some sort of storage and retrieval mechanism. The disk cache has its own file and directory structure that it expects, so using it to serve your pre-cut tiles would probably be a problem.

So, I'm not going to do that. Now I will work on serving with a more complete stack that includes Mapnik for rendering via tilestrata-mapnik. He did rewrite part of tilestrata-disk so that it can be used as a "provider" should anyone care to try that.


I'm stuck with a server that runs without errors, but offers no output. I don't know what's wrong, but my guesses are something to do with the raster's xml stylesheet (used by Mapnik to render the tiles from their GTiff source) or the source layer's projection (EPSG:3857 - spherical mercator).

This is what I have so far in my server.js file:

var tilestrata = require('tilestrata'); var disk = require('tilestrata-disk'); var mapnik = require('tilestrata-mapnik'); var strata = tilestrata.createServer(); //define layers strata.layer('srtm') .route('tile.png">http://localhost:8080/0/0/0/tile.png">http://localhost:8080/0/0/0/tile.png">

I forgot to include the layer in the url.

As the documentation clearly points out, the URL format works like this:

http://localhost://///

With that small change, I now have it working on my Mapbox.js map without any problems.