2017-12-04 19:40:53 +08:00
|
|
|
require('../support/test_helper');
|
|
|
|
|
|
|
|
const assert = require('../support/assert');
|
|
|
|
const TestClient = require('../support/test-client');
|
|
|
|
const serverOptions = require('../../lib/cartodb/server_options');
|
|
|
|
|
|
|
|
const suites = [{
|
|
|
|
desc: 'mvt (mapnik)',
|
|
|
|
usePostGIS: false
|
|
|
|
}];
|
|
|
|
|
|
|
|
if (process.env.POSTGIS_VERSION === '2.4') {
|
|
|
|
suites.push({
|
|
|
|
desc: 'mvt (postgis)',
|
|
|
|
usePostGIS: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('aggregation', 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
|
|
|
|
`;
|
|
|
|
|
2017-12-14 21:14:55 +08:00
|
|
|
const POINTS_SQL_TIMESTAMP_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,
|
|
|
|
date
|
|
|
|
from
|
|
|
|
generate_series(-3, 3) x,
|
|
|
|
generate_series(
|
|
|
|
'2007-02-15 01:00:00'::timestamp, '2007-02-18 01:00:00'::timestamp, '1 day'::interval
|
|
|
|
) date
|
|
|
|
`;
|
|
|
|
|
2017-12-04 19:40:53 +08:00
|
|
|
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,
|
2017-12-05 02:48:06 +08:00
|
|
|
x as value,
|
|
|
|
x*x as sqrt_value
|
2017-12-04 19:40:53 +08:00
|
|
|
from generate_series(-3, 3) x
|
|
|
|
`;
|
|
|
|
|
2017-12-12 00:32:06 +08:00
|
|
|
const POLYGONS_SQL_1 = `
|
2017-12-06 03:21:20 +08:00
|
|
|
select
|
2017-12-12 00:32:06 +08:00
|
|
|
st_buffer(st_setsrid(st_makepoint(x*10, x*10), 4326)::geography, 100000)::geometry as the_geom,
|
|
|
|
st_transform(
|
|
|
|
st_buffer(st_setsrid(st_makepoint(x*10, x*10), 4326)::geography, 100000)::geometry,
|
|
|
|
3857
|
|
|
|
) as the_geom_webmercator,
|
|
|
|
x as value
|
2017-12-06 03:21:20 +08:00
|
|
|
from generate_series(-3, 3) x
|
|
|
|
`;
|
|
|
|
|
2017-12-13 23:34:36 +08:00
|
|
|
const SQL_WRAP = `
|
|
|
|
WITH hgrid AS (
|
|
|
|
SELECT
|
|
|
|
CDB_RectangleGrid (
|
|
|
|
ST_Expand(!bbox!, CDB_XYZ_Resolution(1) * 12),
|
|
|
|
CDB_XYZ_Resolution(1) * 12,
|
|
|
|
CDB_XYZ_Resolution(1) * 12
|
|
|
|
) as cell
|
|
|
|
)
|
|
|
|
SELECT
|
|
|
|
hgrid.cell as the_geom_webmercator,
|
|
|
|
count(1) as agg_value,
|
|
|
|
count(1) /power( 12 * CDB_XYZ_Resolution(1), 2 ) as agg_value_density,
|
|
|
|
row_number() over () as cartodb_id
|
|
|
|
FROM hgrid, (<%= sql %>) i
|
|
|
|
WHERE ST_Intersects(i.the_geom_webmercator, hgrid.cell) GROUP BY hgrid.cell
|
|
|
|
`;
|
2017-12-12 00:32:06 +08:00
|
|
|
|
2017-12-14 02:46:35 +08:00
|
|
|
const TURBO_CARTOCSS_SQL_WRAP = `
|
|
|
|
#layer {
|
|
|
|
polygon-fill: ramp([agg_value], (#245668, #04817E, #39AB7E, #8BD16D, #EDEF5D), quantiles);
|
|
|
|
}
|
|
|
|
#layer::outline {
|
|
|
|
line-width: 1;
|
|
|
|
line-color: #FFFFFF;
|
|
|
|
line-opacity: 1;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2017-12-04 19:40:53 +08:00
|
|
|
function createVectorMapConfig (layers = [
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: POINTS_SQL_1,
|
|
|
|
aggregation: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: POINTS_SQL_2,
|
|
|
|
aggregation: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]) {
|
|
|
|
return {
|
|
|
|
version: '1.6.0',
|
|
|
|
layers: layers
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
suites.forEach((suite) => {
|
|
|
|
const { desc, usePostGIS } = suite;
|
|
|
|
|
2017-12-06 00:44:52 +08:00
|
|
|
describe(desc, function () {
|
2017-12-04 19:40:53 +08:00
|
|
|
const originalUsePostGIS = serverOptions.renderer.mvt.usePostGIS;
|
|
|
|
|
|
|
|
before(function () {
|
|
|
|
serverOptions.renderer.mvt.usePostGIS = usePostGIS;
|
|
|
|
});
|
|
|
|
|
|
|
|
after(function (){
|
|
|
|
serverOptions.renderer.mvt.usePostGIS = originalUsePostGIS;
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function (done) {
|
|
|
|
this.testClient.drain(done);
|
|
|
|
});
|
|
|
|
|
2017-12-05 02:48:06 +08:00
|
|
|
it('should return a layergroup indicating the mapconfig was aggregated', function (done) {
|
2017-12-12 00:32:06 +08:00
|
|
|
this.mapConfig = createVectorMapConfig([
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: POINTS_SQL_1,
|
|
|
|
aggregation: {
|
|
|
|
threshold: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: POINTS_SQL_2,
|
|
|
|
aggregation: {
|
|
|
|
threshold: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
2017-12-05 02:48:06 +08:00
|
|
|
this.testClient = new TestClient(this.mapConfig);
|
|
|
|
|
2017-12-04 19:40:53 +08:00
|
|
|
this.testClient.getLayergroup((err, body) => {
|
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(typeof body.metadata, 'object');
|
|
|
|
assert.ok(Array.isArray(body.metadata.layers));
|
|
|
|
|
2017-12-05 23:52:15 +08:00
|
|
|
body.metadata.layers.forEach(layer => assert.ok(layer.meta.aggregation.mvt));
|
2017-12-06 03:21:20 +08:00
|
|
|
body.metadata.layers.forEach(layer => assert.ok(!layer.meta.aggregation.png));
|
2017-12-04 19:40:53 +08:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2017-12-05 02:48:06 +08:00
|
|
|
|
|
|
|
it('should return a layergroup with aggregation and cartocss compatible', function (done) {
|
|
|
|
this.mapConfig = createVectorMapConfig([
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: POINTS_SQL_1,
|
|
|
|
aggregation: {
|
|
|
|
columns: {
|
|
|
|
total: {
|
|
|
|
aggregate_function: 'sum',
|
|
|
|
aggregated_column: 'value'
|
|
|
|
}
|
2017-12-12 00:32:06 +08:00
|
|
|
},
|
|
|
|
threshold: 1
|
2017-12-05 02:48:06 +08:00
|
|
|
},
|
2017-12-12 18:19:05 +08:00
|
|
|
cartocss: '#layer { marker-width: [total]; }',
|
2017-12-05 02:48:06 +08:00
|
|
|
cartocss_version: '2.3.0'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
this.testClient = new TestClient(this.mapConfig);
|
2017-12-05 23:52:15 +08:00
|
|
|
this.testClient.getLayergroup((err, body) => {
|
2017-12-05 02:48:06 +08:00
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
2017-12-05 23:52:15 +08:00
|
|
|
assert.equal(typeof body.metadata, 'object');
|
|
|
|
assert.ok(Array.isArray(body.metadata.layers));
|
|
|
|
|
|
|
|
body.metadata.layers.forEach(layer => assert.ok(layer.meta.aggregation.mvt));
|
2017-12-06 03:21:20 +08:00
|
|
|
body.metadata.layers.forEach(layer => assert.ok(layer.meta.aggregation.png));
|
2017-12-05 23:52:15 +08:00
|
|
|
|
2017-12-05 02:48:06 +08:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-12-12 19:15:13 +08:00
|
|
|
it('should fail when aggregation and cartocss are not compatible', function (done) {
|
|
|
|
const response = {
|
|
|
|
status: 400,
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json; charset=utf-8'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
this.mapConfig = createVectorMapConfig([
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: POINTS_SQL_1,
|
|
|
|
aggregation: {
|
|
|
|
columns: {
|
|
|
|
total: {
|
|
|
|
aggregate_function: 'sum',
|
|
|
|
aggregated_column: 'value'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
threshold: 1
|
|
|
|
},
|
|
|
|
cartocss: '#layer { marker-width: [value]; }',
|
|
|
|
cartocss_version: '2.3.0'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
this.testClient = new TestClient(this.mapConfig);
|
|
|
|
this.testClient.getLayergroup({ response }, (err, body) => {
|
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
2017-12-14 02:46:35 +08:00
|
|
|
assert.ok(body.errors[0].match(/column "value" does not exist/));
|
2017-12-12 19:15:13 +08:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-12-05 23:52:15 +08:00
|
|
|
it('should fail if cartocss uses "value" column and it\'s not defined in the aggregation',
|
2017-12-05 02:48:06 +08:00
|
|
|
function (done) {
|
|
|
|
const response = {
|
|
|
|
status: 400,
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json; charset=utf-8'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
this.mapConfig = createVectorMapConfig([
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: POINTS_SQL_2,
|
|
|
|
aggregation: {
|
2017-12-14 02:46:35 +08:00
|
|
|
threshold: 1
|
2017-12-05 02:48:06 +08:00
|
|
|
},
|
|
|
|
cartocss: '#layer { marker-width: [value]; }',
|
2017-12-14 02:46:35 +08:00
|
|
|
cartocss_version: '2.3.0'
|
2017-12-05 02:48:06 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
this.testClient = new TestClient(this.mapConfig);
|
2017-12-05 19:09:31 +08:00
|
|
|
this.testClient.getLayergroup({ response }, (err, body) => {
|
2017-12-05 02:48:06 +08:00
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
2017-12-14 02:46:35 +08:00
|
|
|
assert.ok(body.errors[0].match(/column "value" does not exist/));
|
2017-12-05 02:48:06 +08:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-12-05 19:59:32 +08:00
|
|
|
it('should skip aggregation to create a layergroup with aggregation defined already', function (done) {
|
|
|
|
const mapConfig = createVectorMapConfig([
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: POINTS_SQL_1,
|
|
|
|
aggregation: {
|
|
|
|
columns: {
|
|
|
|
total: {
|
|
|
|
aggregate_function: 'sum',
|
|
|
|
aggregated_column: 'value'
|
|
|
|
}
|
2017-12-13 02:23:21 +08:00
|
|
|
},
|
|
|
|
threshold: 1
|
2017-12-05 19:59:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
this.testClient = new TestClient(mapConfig);
|
|
|
|
const options = { aggregation: false };
|
|
|
|
|
|
|
|
this.testClient.getLayergroup(options, (err, body) => {
|
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(typeof body.metadata, 'object');
|
|
|
|
assert.ok(Array.isArray(body.metadata.layers));
|
|
|
|
|
2017-12-13 02:23:21 +08:00
|
|
|
body.metadata.layers.forEach(layer => assert.equal(layer.meta.aggregation, undefined));
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('when the aggregation param is not valid should respond with error', function (done) {
|
|
|
|
const mapConfig = createVectorMapConfig([
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: POINTS_SQL_1,
|
|
|
|
aggregation: {
|
|
|
|
threshold: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
this.testClient = new TestClient(mapConfig);
|
|
|
|
const options = {
|
|
|
|
response: {
|
|
|
|
status: 400
|
|
|
|
},
|
|
|
|
aggregation: 'wadus'
|
|
|
|
};
|
|
|
|
|
|
|
|
this.testClient.getLayergroup(options, (err, body) => {
|
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.deepEqual(body, {
|
|
|
|
errors: [
|
|
|
|
"Invalid value for 'aggregation' query param: wadus." +
|
|
|
|
" Valid ones are 'true' or 'false'"
|
|
|
|
],
|
|
|
|
errors_with_context:[{
|
|
|
|
type: 'unknown',
|
|
|
|
message: "Invalid value for 'aggregation' query param: wadus." +
|
|
|
|
" Valid ones are 'true' or 'false'"
|
|
|
|
}]
|
|
|
|
});
|
2017-12-05 19:59:32 +08:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2017-12-06 03:21:20 +08:00
|
|
|
|
2017-12-12 00:32:06 +08:00
|
|
|
it('when the layer\'s row count is lower than threshold should skip aggregation', function (done) {
|
|
|
|
const mapConfig = createVectorMapConfig([
|
2017-12-06 03:21:20 +08:00
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
2017-12-12 00:32:06 +08:00
|
|
|
sql: POINTS_SQL_1,
|
|
|
|
aggregation: {
|
|
|
|
columns: {
|
|
|
|
total: {
|
|
|
|
aggregate_function: 'sum',
|
|
|
|
aggregated_column: 'value'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
threshold: 1001
|
|
|
|
}
|
2017-12-06 03:21:20 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
2017-12-12 00:32:06 +08:00
|
|
|
this.testClient = new TestClient(mapConfig);
|
|
|
|
const options = {};
|
|
|
|
|
|
|
|
this.testClient.getLayergroup(options, (err, body) => {
|
2017-12-06 03:21:20 +08:00
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(typeof body.metadata, 'object');
|
|
|
|
assert.ok(Array.isArray(body.metadata.layers));
|
|
|
|
|
2017-12-12 00:32:06 +08:00
|
|
|
body.metadata.layers.forEach(layer =>{
|
|
|
|
assert.deepEqual(layer.meta.aggregation, { png: false, mvt: false });
|
|
|
|
});
|
2017-12-06 03:21:20 +08:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-12-13 02:23:21 +08:00
|
|
|
it('when the layer\'s geometry type is not point should respond with error', function (done) {
|
2017-12-12 00:32:06 +08:00
|
|
|
const mapConfig = createVectorMapConfig([
|
2017-12-06 03:21:20 +08:00
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
2017-12-12 00:32:06 +08:00
|
|
|
sql: POLYGONS_SQL_1,
|
|
|
|
aggregation: {
|
|
|
|
threshold: 1
|
|
|
|
}
|
2017-12-06 03:21:20 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
2017-12-12 00:32:06 +08:00
|
|
|
this.testClient = new TestClient(mapConfig);
|
|
|
|
const options = {
|
|
|
|
response: {
|
|
|
|
status: 400
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
this.testClient.getLayergroup(options, (err, body) => {
|
2017-12-06 03:21:20 +08:00
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
2017-12-12 00:32:06 +08:00
|
|
|
assert.deepEqual(body, {
|
|
|
|
errors: [
|
2017-12-12 19:39:12 +08:00
|
|
|
'Unsupported geometry type: ST_Polygon.' +
|
|
|
|
' Aggregation is available only for geometry type: ST_Point'
|
2017-12-12 00:32:06 +08:00
|
|
|
],
|
|
|
|
errors_with_context:[{
|
|
|
|
type: 'unknown',
|
2017-12-12 19:39:12 +08:00
|
|
|
message: 'Unsupported geometry type: ST_Polygon.' +
|
|
|
|
' Aggregation is available only for geometry type: ST_Point'
|
2017-12-12 00:32:06 +08:00
|
|
|
}]
|
|
|
|
});
|
2017-12-06 03:21:20 +08:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2017-12-13 23:34:36 +08:00
|
|
|
|
|
|
|
it('when sql_wrap is provided should return a layergroup', function (done) {
|
|
|
|
this.mapConfig = createVectorMapConfig([
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql_wrap: SQL_WRAP,
|
|
|
|
sql: POINTS_SQL_1,
|
|
|
|
aggregation: {
|
|
|
|
threshold: 1
|
2017-12-14 02:46:35 +08:00
|
|
|
},
|
|
|
|
cartocss: TURBO_CARTOCSS_SQL_WRAP,
|
|
|
|
cartocss_version: '3.0.12'
|
2017-12-13 23:34:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
this.testClient = new TestClient(this.mapConfig);
|
|
|
|
|
|
|
|
this.testClient.getLayergroup((err, body) => {
|
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(typeof body.metadata, 'object');
|
|
|
|
assert.ok(Array.isArray(body.metadata.layers));
|
|
|
|
|
|
|
|
body.metadata.layers.forEach(layer => assert.ok(layer.meta.aggregation.mvt));
|
2017-12-14 02:46:35 +08:00
|
|
|
body.metadata.layers.forEach(layer => assert.ok(layer.meta.aggregation.png));
|
2017-12-13 23:34:36 +08:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2017-12-14 00:01:43 +08:00
|
|
|
|
|
|
|
it('when sql_wrap is provided should return a tile', function (done) {
|
|
|
|
this.mapConfig = createVectorMapConfig([
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql_wrap: SQL_WRAP,
|
|
|
|
sql: POINTS_SQL_1,
|
|
|
|
aggregation: {
|
|
|
|
threshold: 1
|
|
|
|
},
|
2017-12-14 02:46:35 +08:00
|
|
|
cartocss: TURBO_CARTOCSS_SQL_WRAP,
|
|
|
|
cartocss_version: '3.0.12'
|
2017-12-14 00:01:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
this.testClient = new TestClient(this.mapConfig);
|
|
|
|
|
|
|
|
this.testClient.getTile(0, 0, 0, {}, (err) => {
|
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2017-12-14 21:14:55 +08:00
|
|
|
|
|
|
|
it('should work when the sql has single quotes', function (done) {
|
|
|
|
this.mapConfig = createVectorMapConfig([
|
|
|
|
{
|
|
|
|
type: 'cartodb',
|
|
|
|
options: {
|
|
|
|
sql: `
|
|
|
|
SELECT
|
|
|
|
the_geom_webmercator,
|
|
|
|
the_geom,
|
|
|
|
value,
|
|
|
|
DATE_PART('day', date::timestamp - '1912-12-31 01:00:00'::timestamp )::numeric AS day
|
|
|
|
FROM (${POINTS_SQL_TIMESTAMP_1}) _query
|
|
|
|
`,
|
|
|
|
aggregation: {
|
|
|
|
threshold: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
this.testClient = new TestClient(this.mapConfig);
|
|
|
|
|
|
|
|
this.testClient.getLayergroup((err, body) => {
|
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(typeof body.metadata, 'object');
|
|
|
|
assert.ok(Array.isArray(body.metadata.layers));
|
|
|
|
|
|
|
|
body.metadata.layers.forEach(layer => assert.ok(layer.meta.aggregation.mvt));
|
|
|
|
body.metadata.layers.forEach(layer => assert.ok(!layer.meta.aggregation.png));
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2017-12-04 19:40:53 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|