Support mvt tiles

This commit is contained in:
Daniel García Aubert 2017-04-24 18:55:08 +02:00
parent c4ff884ad0
commit fed953d195

View File

@ -485,6 +485,13 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
expectedResponse.headers['Content-Type'] = 'image/png';
}
var isMvt = format.match(/mvt$/);
if (isMvt) {
request.encoding = 'binary';
expectedResponse.headers['Content-Type'] = 'application/x-protobuf';
}
assert.response(server, request, expectedResponse, function(res, err) {
assert.ifError(err);
@ -492,7 +499,13 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
if (isPng) {
obj = mapnik.Image.fromBytes(new Buffer(res.body, 'binary'));
} else {
}
else if (isMvt) {
obj = new mapnik.VectorTile(z, x, y);
obj.setDataSync(new Buffer(res.body, 'binary'));
}
else {
obj = JSON.parse(res.body);
}