Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sourceParams.DPI = dpi;
sourceParams.MAP_RESOLUTION = dpi;
sourceParams.FORMAT_OPTIONS = 'dpi:' + dpi;
if (options.refreshIntervalSec && options.refreshIntervalSec > 0) {
setInterval(() => {
this.refresh();
}, options.refreshIntervalSec * 1000); // Convert seconds to MS
}
let fieldNameGeometry = defaultFieldNameGeometry;
// #### START if paramsWFS
if (options.paramsWFS) {
const wfsCheckup = checkWfsParams(options, 'wms');
ObjectUtils.mergeDeep(options.paramsWFS, wfsCheckup.paramsWFS);
fieldNameGeometry =
options.paramsWFS.fieldNameGeometry || fieldNameGeometry;
options.download = Object.assign({}, options.download, {
dynamicUrl: this.buildDynamicDownloadUrlFromParamsWFS(options)
});
} // #### END if paramsWFS
if (!options.sourceFields || options.sourceFields.length === 0) {
options.sourceFields = [];
} else {
options.sourceFields.forEach(sourceField => {
sourceField.alias = sourceField.alias
? sourceField.alias
: sourceField.name;
map(translations => {
return ObjectUtils.mergeDeep(translations[0], translations[1]);
})
);
minResolution:
getResolutionFromScale(layer.MinScaleDenominator) || 0,
metadata: {
url: metadata ? metadata.OnlineResource : undefined,
extern: metadata ? true : undefined,
abstract,
keywordList
},
legendOptions
},
queryable,
timeFilter: timeFilterable ? timeFilter : undefined,
timeFilterable: timeFilterable ? true : undefined
});
return ObjectUtils.mergeDeep(options, baseOptions);
}
createLayer(layerOptions: AnyLayerOptions): Layer {
if (!layerOptions.source) {
return;
}
if (
layerOptions.source.options &&
layerOptions.source.options.optionsFromCapabilities
) {
layerOptions = ObjectUtils.mergeDeep(
layerOptions,
(layerOptions.source.options as any)._layerOptionsFromCapabilities
);
}
let layer;
switch (layerOptions.source.constructor) {
case OSMDataSource:
case WMTSDataSource:
case XYZDataSource:
case CartoDataSource:
case TileArcGISRestDataSource:
layer = this.createTileLayer(layerOptions as TileLayerOptions);
break;
case FeatureDataSource:
case WFSDataSource:
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);
}
createLayer(layerOptions: AnyLayerOptions): Layer {
if (!layerOptions.source) {
return;
}
if (
layerOptions.source.options &&
layerOptions.source.options.optionsFromCapabilities
) {
layerOptions = ObjectUtils.mergeDeep(
(layerOptions.source.options as any)._layerOptionsFromCapabilities ||
{},
layerOptions || {}
);
}
let layer;
switch (layerOptions.source.constructor) {
case OSMDataSource:
case WMTSDataSource:
case XYZDataSource:
case CartoDataSource:
case TileArcGISRestDataSource:
layer = this.createTileLayer(layerOptions as TileLayerOptions);
break;
case FeatureDataSource:
};
}
const params = Object.assign(
{},
{
legendInfo,
style,
timeFilter,
timeExtent,
attributions
}
);
const options = ObjectUtils.removeUndefined({
params
});
return ObjectUtils.mergeDeep(options, baseOptions);
}