Adapt layer when is vector only map-caonfig

This commit is contained in:
Daniel García Aubert
2017-12-05 20:39:30 +01:00
parent 9118e2dc5e
commit 214d684fcc
2 changed files with 11 additions and 5 deletions
@@ -22,7 +22,7 @@ module.exports = class AggregationMapConfigAdapter {
requestMapConfig.layers = this._adaptLayers(mapConfig, requestMapConfig);
context.aggregation = {
layers: this._getAggregationMetadata(requestMapConfig),
layers: this._getAggregationMetadata(mapConfig, requestMapConfig),
};
callback(null, requestMapConfig);
@@ -102,8 +102,9 @@ module.exports = class AggregationMapConfigAdapter {
}
_adaptLayers (mapConfig, requestMapConfig) {
const isVectorOnlyMapConfig = mapConfig.isVectorOnlyMapConfig();
return requestMapConfig.layers.map(layer => {
if (this._hasLayerAggregation(layer)) {
if (isVectorOnlyMapConfig || this._hasLayerAggregation(layer)) {
const aggregation = new AggregationProxy(mapConfig, layer.options.aggregation);
const sqlQueryWrap = layer.options.sql_wrap;
@@ -121,10 +122,16 @@ module.exports = class AggregationMapConfigAdapter {
});
}
_getAggregationMetadata (requestMapConfig) {
_getAggregationMetadata (mapConfig, requestMapConfig) {
if (mapConfig.isVectorOnlyMapConfig()) {
return requestMapConfig.layers.map((/* layer */) => {
return { png: false, mvt: true };
});
}
return requestMapConfig.layers.map(layer => {
return this._hasLayerAggregation(layer) ?
{ png: false, mvt: true } :
{ png: true, mvt: true } :
{ png: false, mvt: false };
});
}
-1
View File
@@ -266,7 +266,6 @@ describe('aggregation', function () {
return done(err);
}
console.log(require('util').inspect(body, { depth: null }));
assert.equal(typeof body.metadata, 'object');
assert.ok(Array.isArray(body.metadata.layers));