Adapt layer when is vector only map-caonfig
This commit is contained in:
@@ -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 };
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user