tilelive-template
Same as tilelive-file but get file's path from a path template
Introduction
tilelive-file's path rule is set to {z}/{x}/{y}, but in reality, the path rule to store tile files is usually arbitrary.
For example, some vendor stores a tile**(x: 54305 y:26571 z:16)** in the following path:
/path/to/root/16/5430/2657/54305_26571.png
In this case, we can use a path template:
var template = '/path/to/tiles/${z}/${parseInt(x/10)}/${parseInt(y/10)}/${x}_${y}.png';
This is the reason tilelive-template is borned.
tilelive-template uses lodash.template as the template engine, and ES delimiter(${foo}) is used as the default "interpolate" delimiter.
You can see how to use it in the example below.
Install
npm install tilelive-template
Tilelive Protocol
// template is the path template // filetype is the tile file's type, default is pngvar protocol = 'template+file://path/to/root?template=${z}/${x}/${y}&filetype=png';
Usage
var TemplateLive = assert = crypto = ; { return crypto;} 'template+file://./test/fixtures/readonly?template=${z}/${x}/${y}&filetype=png' { if err throw err; source;};