3

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')
        .use(disk.cache({dir: './tiles/srtm/'}))
        .use(mapnik({
            xml: './styles/srtm.xml',
            tileSize: 256,
            scale: 1
        }));
strata.listen(8080);

I've gotten rid of all the errors that showed up due to bad XML, but I can't get it the tiles to serve. I when I navigate to http://localhost:8080/0/0/0/tile.png per Brian's suggestions, I just get a message that reads: "The image 'http://localhost:8080/0/0/0/tile.png' cannot be displayed because it contains errors."

2

I forgot to include the layer in the url.

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

http://localhost:<port>/<layer-name>/<z>/<x>/<y>/<route-name>

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.