forked from mojodna/tilelive-blend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
43 lines (37 loc) · 949 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"use strict";
var fs = require("fs");
var tilelive = require("@mapbox/tilelive");
require("@mapbox/tilejson").registerProtocols(tilelive);
require("./")(tilelive);
tilelive.load({
protocol: "blend:",
query: {
layers: [
{
source: "tilejson+http://staging.tile.stamen.com/toner-background/index.json",
opacity: 0.5,
filters: "color-to-alpha(#008800)",
offset: [5, -5]
},
{
source: "tilejson+http://staging.tile.stamen.com/toner-lines/index.json",
filters: "invert agg-stack-blur(1,1)"
},
{
source: "tilejson+http://staging.tile.stamen.com/toner-labels/index.json",
"comp-op": "over"
}
],
format: "png32:z=1"
}
}, function(err, source) {
if (err) {
throw err;
}
return source.getTile(12, 656, 1430, function(err, data) {
if (err) {
throw err;
}
return fs.writeFileSync("./out.png", data);
});
});