Merge branch 'master' into mapconfig-aggregation

This commit is contained in:
Daniel García Aubert 2017-12-04 14:49:44 +01:00
commit 91e0e0fd18
4 changed files with 34 additions and 201 deletions

13
NEWS.md
View File

@ -1,11 +1,24 @@
# Changelog # Changelog
## 4.2.1
Released 2017-mm-dd
## 4.2.0
Released 2017-12-04
Announcements:
- Allow to request MVT tiles without CartoCSS
- Upgrades windshaft to [4.1.0](https://github.com/CartoDB/windshaft/releases/tag/4.1.0).
## 4.1.1 ## 4.1.1
Released 2017-11-29 Released 2017-11-29
Announcements: Announcements:
- Upgrades turbo-carto to [0.20.2](https://github.com/CartoDB/turbo-carto/releases/tag/0.20.2). - Upgrades turbo-carto to [0.20.2](https://github.com/CartoDB/turbo-carto/releases/tag/0.20.2).
## 4.1.0 ## 4.1.0
Released 2017-mm-dd Released 2017-mm-dd

View File

@ -1,7 +1,7 @@
{ {
"private": true, "private": true,
"name": "windshaft-cartodb", "name": "windshaft-cartodb",
"version": "4.1.1", "version": "4.2.1",
"description": "A map tile server for CartoDB", "description": "A map tile server for CartoDB",
"keywords": [ "keywords": [
"cartodb" "cartodb"
@ -44,7 +44,7 @@
"step-profiler": "~0.3.0", "step-profiler": "~0.3.0",
"turbo-carto": "0.20.2", "turbo-carto": "0.20.2",
"underscore": "~1.6.0", "underscore": "~1.6.0",
"windshaft": "cartodb/windshaft#vr-aggretation", "windshaft": "4.1.0",
"yargs": "~5.0.0" "yargs": "~5.0.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -34,186 +34,6 @@ return function () {
serverOptions.renderer.mvt.usePostGIS = originalUsePostGIS; serverOptions.renderer.mvt.usePostGIS = originalUsePostGIS;
}); });
describe('vector-layergroup', function () {
const POINTS_SQL_1 = `
select
st_setsrid(st_makepoint(x*10, x*10), 4326) as the_geom,
st_transform(st_setsrid(st_makepoint(x*10, x*10), 4326), 3857) as the_geom_webmercator,
x as value
from generate_series(-3, 3) x
`;
const POINTS_SQL_2 = `
select
st_setsrid(st_makepoint(x*10, x*10*(-1)), 4326) as the_geom,
st_transform(st_setsrid(st_makepoint(x*10, x*10*(-1)), 4326), 3857) as the_geom_webmercator,
x as value
from generate_series(-3, 3) x
`;
function createVectorLayergroup () {
return {
version: '1.6.0',
layers: [
{
type: 'cartodb',
options: {
sql: POINTS_SQL_1
}
},
{
type: 'cartodb',
options: {
sql: POINTS_SQL_2
}
}
]
};
}
beforeEach(function () {
this.mapConfig = createVectorLayergroup();
this.testClient = new TestClient(this.mapConfig);
});
afterEach(function (done) {
this.testClient.drain(done);
});
it('should get vector tiles from layergroup with layers w/o cartocss', function (done) {
this.testClient.getTile(0, 0, 0, { format: 'mvt' }, (err, res, tile) => {
if (err) {
return done(err);
}
assert.equal(tile.tileSize, 4096);
assert.equal(tile.z, 0);
assert.equal(tile.x, 0);
assert.equal(tile.y, 0);
const layer0 = JSON.parse(tile.toGeoJSONSync(0));
assert.equal(layer0.name, 'layer0');
assert.equal(layer0.features[0].type, 'Feature');
assert.equal(layer0.features[0].geometry.type, 'Point');
const layer1 = JSON.parse(tile.toGeoJSONSync(1));
assert.equal(layer1.name, 'layer1');
assert.equal(layer1.features[0].type, 'Feature');
assert.equal(layer1.features[0].geometry.type, 'Point');
done();
});
});
it('should get vector tiles from specific layer (layer0)', function (done) {
this.testClient.getTile(0, 0, 0, { format: 'mvt', layers: 0 }, (err, res, tile) => {
if (err) {
return done(err);
}
assert.equal(tile.tileSize, 4096);
assert.equal(tile.z, 0);
assert.equal(tile.x, 0);
assert.equal(tile.y, 0);
const layer = JSON.parse(tile.toGeoJSONSync(0));
assert.equal(layer.name, 'layer0');
assert.equal(layer.features[0].type, 'Feature');
assert.equal(layer.features[0].geometry.type, 'Point');
done();
});
});
it('should get vector tiles from specific layer (layer1)', function (done) {
this.testClient.getTile(0, 0, 0, { format: 'mvt', layers: 1 }, (err, res, tile) => {
if (err) {
return done(err);
}
assert.equal(tile.tileSize, 4096);
assert.equal(tile.z, 0);
assert.equal(tile.x, 0);
assert.equal(tile.y, 0);
const layer = JSON.parse(tile.toGeoJSONSync(0));
assert.equal(layer.name, 'layer1');
assert.equal(layer.features[0].type, 'Feature');
assert.equal(layer.features[0].geometry.type, 'Point');
done();
});
});
it('should fail when the format requested is not mvt', function (done) {
const options = {
format: 'png',
response: {
status: 400,
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
}
};
this.testClient.getTile(0, 0, 0, options, (err, res, body) => {
if (err) {
return done(err);
}
assert.deepEqual(body, {
"errors": [
"Unsupported format: 'cartocss' option is missing for png"
],
"errors_with_context":[
{
"type":"tile",
"message":"Unsupported format: 'cartocss' option is missing for png"
}
]
});
done();
});
});
it('should fail when the map-config mix layers with and without cartocss', function (done) {
const response = {
status: 400,
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
};
this.testClient.mapConfig.layers[0].options.cartocss = '#layer0 { marker-fill: red; marker-width: 10; }';
this.testClient.mapConfig.layers[0].options.cartocss_version = '2.3.0';
this.testClient.getLayergroup(response, (err, body) => {
if (err) {
return done(err);
}
assert.deepEqual(body, {
"errors": [
"The `mapnik` or `cartodb` layers must be consistent:" +
" `cartocss` option is either present or voided in all layers. Mixing is not allowed."
],
"errors_with_context":[
{
"type":"mapconfig",
"message": "The `mapnik` or `cartodb` layers must be consistent:" +
" `cartocss` option is either present or voided in all layers. Mixing is not allowed."
}
]
});
done();
});
});
});
describe('analysis-layers-dataviews-mvt', function () { describe('analysis-layers-dataviews-mvt', function () {
function createMapConfig(layers, dataviews, analysis) { function createMapConfig(layers, dataviews, analysis) {

View File

@ -2,7 +2,7 @@
# yarn lockfile v1 # yarn lockfile v1
abaculus@cartodb/abaculus#2.0.3-cdb1: "abaculus@github:cartodb/abaculus#2.0.3-cdb1":
version "2.0.3-cdb1" version "2.0.3-cdb1"
resolved "https://codeload.github.com/cartodb/abaculus/tar.gz/f5f34e1c80cdd8d49edd1d6fe3b2220ab2e23aaf" resolved "https://codeload.github.com/cartodb/abaculus/tar.gz/f5f34e1c80cdd8d49edd1d6fe3b2220ab2e23aaf"
dependencies: dependencies:
@ -222,7 +222,7 @@ camshaft@0.59.4:
dot "^1.0.3" dot "^1.0.3"
request "^2.69.0" request "^2.69.0"
canvas@cartodb/node-canvas#1.6.2-cdb2: "canvas@github:cartodb/node-canvas#1.6.2-cdb2":
version "1.6.2-cdb2" version "1.6.2-cdb2"
resolved "https://codeload.github.com/cartodb/node-canvas/tar.gz/8acf04557005c633f9e68524488a2657c04f3766" resolved "https://codeload.github.com/cartodb/node-canvas/tar.gz/8acf04557005c633f9e68524488a2657c04f3766"
dependencies: dependencies:
@ -240,14 +240,6 @@ carto@0.16.3:
semver "^5.1.0" semver "^5.1.0"
yargs "^4.2.0" yargs "^4.2.0"
carto@cartodb/carto#0.15.1-cdb3:
version "0.15.1-cdb3"
resolved "https://codeload.github.com/cartodb/carto/tar.gz/945f5efb74fd1af1f5e1f69f409f9567f94fb5a7"
dependencies:
mapnik-reference "~6.0.2"
optimist "~0.6.0"
underscore "1.8.3"
"carto@github:cartodb/carto#0.15.1-cdb1": "carto@github:cartodb/carto#0.15.1-cdb1":
version "0.15.1-cdb1" version "0.15.1-cdb1"
resolved "https://codeload.github.com/cartodb/carto/tar.gz/8050ec843f1f32a6469e5d1cf49602773015d398" resolved "https://codeload.github.com/cartodb/carto/tar.gz/8050ec843f1f32a6469e5d1cf49602773015d398"
@ -256,6 +248,14 @@ carto@cartodb/carto#0.15.1-cdb3:
optimist "~0.6.0" optimist "~0.6.0"
underscore "~1.6.0" underscore "~1.6.0"
"carto@github:cartodb/carto#0.15.1-cdb3":
version "0.15.1-cdb3"
resolved "https://codeload.github.com/cartodb/carto/tar.gz/945f5efb74fd1af1f5e1f69f409f9567f94fb5a7"
dependencies:
mapnik-reference "~6.0.2"
optimist "~0.6.0"
underscore "1.8.3"
cartocolor@4.0.0: cartocolor@4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/cartocolor/-/cartocolor-4.0.0.tgz#841a3222d8b5b22718d9d545b1e5b972cb26eb36" resolved "https://registry.yarnpkg.com/cartocolor/-/cartocolor-4.0.0.tgz#841a3222d8b5b22718d9d545b1e5b972cb26eb36"
@ -826,9 +826,9 @@ graceful-fs@^4.1.2:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725"
grainstore@~1.6.0: grainstore@1.7.0:
version "1.6.4" version "1.7.0"
resolved "https://registry.yarnpkg.com/grainstore/-/grainstore-1.6.4.tgz#617b93c5e2de8f544375202da89b9208a8b3d762" resolved "https://registry.yarnpkg.com/grainstore/-/grainstore-1.7.0.tgz#28d78895c82e6201f7d0ff63af1056f3c0fda0d3"
dependencies: dependencies:
carto "0.16.3" carto "0.16.3"
debug "~3.1.0" debug "~3.1.0"
@ -2190,7 +2190,7 @@ through@2:
version "2.3.8" version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
tilelive-bridge@cartodb/tilelive-bridge#2.3.1-cdb4: "tilelive-bridge@github:cartodb/tilelive-bridge#2.3.1-cdb4":
version "2.3.1-cdb4" version "2.3.1-cdb4"
resolved "https://codeload.github.com/cartodb/tilelive-bridge/tar.gz/faa2b638da2d119b78281575d40255cb523f6ca6" resolved "https://codeload.github.com/cartodb/tilelive-bridge/tar.gz/faa2b638da2d119b78281575d40255cb523f6ca6"
dependencies: dependencies:
@ -2198,7 +2198,7 @@ tilelive-bridge@cartodb/tilelive-bridge#2.3.1-cdb4:
mapnik-pool "~0.1.3" mapnik-pool "~0.1.3"
sphericalmercator "1.0.x" sphericalmercator "1.0.x"
tilelive-mapnik@cartodb/tilelive-mapnik#0.6.18-cdb3: "tilelive-mapnik@github:cartodb/tilelive-mapnik#0.6.18-cdb3":
version "0.6.18-cdb3" version "0.6.18-cdb3"
resolved "https://codeload.github.com/cartodb/tilelive-mapnik/tar.gz/23bd1c31dd57d0b76c86b9f1eaf62462b3c17d01" resolved "https://codeload.github.com/cartodb/tilelive-mapnik/tar.gz/23bd1c31dd57d0b76c86b9f1eaf62462b3c17d01"
dependencies: dependencies:
@ -2359,9 +2359,9 @@ window-size@^0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075"
windshaft@cartodb/windshaft#vr-aggretation: windshaft@^4.1.0:
version "4.0.2" version "4.1.0"
resolved "https://codeload.github.com/cartodb/windshaft/tar.gz/e0cbbafdf7a65537337c3ca185b6fd2f9bac4e59" resolved "https://registry.yarnpkg.com/windshaft/-/windshaft-4.1.0.tgz#dc17c8369570c305171d1ab5ca130369bba04d58"
dependencies: dependencies:
abaculus cartodb/abaculus#2.0.3-cdb1 abaculus cartodb/abaculus#2.0.3-cdb1
canvas cartodb/node-canvas#1.6.2-cdb2 canvas cartodb/node-canvas#1.6.2-cdb2
@ -2369,7 +2369,7 @@ windshaft@cartodb/windshaft#vr-aggretation:
cartodb-psql "^0.10.1" cartodb-psql "^0.10.1"
debug "^3.1.0" debug "^3.1.0"
dot "~1.0.2" dot "~1.0.2"
grainstore "~1.6.0" grainstore "1.7.0"
mapnik "3.5.14" mapnik "3.5.14"
queue-async "~1.0.7" queue-async "~1.0.7"
redis-mpool "0.4.1" redis-mpool "0.4.1"