Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private parseCartoOptions(
baseOptions: CartoDataSourceOptions,
cartoOptions: any
): CartoDataSourceOptions {
const layers = [];
const params = cartoOptions.layers[1].options.layer_definition;
params.layers.forEach(element => {
layers.push({
type: element.type.toLowerCase(),
options: element.options,
legend: element.legend
});
});
const options = ObjectUtils.removeUndefined({
config: {
version: params.version,
layers
}
});
return ObjectUtils.mergeDeep(options, baseOptions);
}
timeFilter = {
min: min.toUTCString(),
max: max.toUTCString(),
range: true,
type: TimeFilterType.DATETIME,
style: TimeFilterStyle.CALENDAR
};
}
const params = Object.assign(
{},
{
layers: 'show:' + baseOptions.layer,
time: timeExtent
}
);
const options = ObjectUtils.removeUndefined({
params,
legendInfo,
timeFilter,
attributions
});
return ObjectUtils.mergeDeep(options, baseOptions);
}
capabilities.Capability.Layer,
layers
);
if (!layer) {
return baseOptions;
}
const metadata = layer.DataURL ? layer.DataURL[0] : undefined;
const abstract = layer.Abstract ? layer.Abstract : undefined;
const keywordList = layer.KeywordList ? layer.KeywordList : undefined;
const queryable = layer.queryable;
const timeFilter = this.getTimeFilter(layer);
const timeFilterable = timeFilter && Object.keys(timeFilter).length > 0;
const legendOptions = layer.Style ? this.getStyle(layer.Style) : undefined;
const options: WMSDataSourceOptions = ObjectUtils.removeUndefined({
_layerOptionsFromCapabilities: {
title: layer.Title,
maxResolution:
getResolutionFromScale(layer.MaxScaleDenominator) || Infinity,
minResolution:
getResolutionFromScale(layer.MinScaleDenominator) || 0,
metadata: {
url: metadata ? metadata.OnlineResource : undefined,
extern: metadata ? true : undefined,
abstract,
keywordList
},
legendOptions
},
queryable,
timeFilter: timeFilterable ? timeFilter : undefined,
range: true,
type: TimeFilterType.DATETIME,
style: TimeFilterStyle.CALENDAR
};
}
const params = Object.assign(
{},
{
legendInfo,
style,
timeFilter,
timeExtent,
attributions
}
);
const options = ObjectUtils.removeUndefined({
params
});
return ObjectUtils.mergeDeep(options, baseOptions);
}