Skip to content

Commit

Permalink
fix(getCapabilities): fix options from getCapatibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Sep 18, 2018
1 parent 85b5c66 commit e6efe73
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
22 changes: 9 additions & 13 deletions projects/geo/src/lib/datasource/shared/capabilities.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,18 @@ export class CapabilitiesService {
const metadata = layer.DataURL ? layer.DataURL[0] : undefined;

const options: WMSDataSourceOptions = ObjectUtils.removeUndefined({
// Save title under "alias" because we want to overwrite
// the default, mandatory title. If the title defined
// in the context is to be used along with the
// "optionsFromCapabilities" option, then it should be
// defined under "alias" in the context
alias: layer.Title,
view: {
_layerOptionsFromCapabilities: {
title: layer.Title,
maxResolution:
this.getResolutionFromScale(layer.MaxScaleDenominator) || Infinity,
minResolution:
this.getResolutionFromScale(layer.MinScaleDenominator) || 0
},
metadata: {
url: metadata ? metadata.OnlineResource : undefined
},
timeFilter: this.getTimeFilter(layer)
this.getResolutionFromScale(layer.MinScaleDenominator) || 0,

metadata: {
url: metadata ? metadata.OnlineResource : undefined
},
timeFilter: this.getTimeFilter(layer)
}
});

return ObjectUtils.mergeDeep(options, baseOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface DataSourceOptions {
| 'arcgisrest'
| 'tilearcgisrest';
legend?: DataSourceLegendOptions;
optionsFromCapabilities?: boolean;
// title: string;
// alias?: string;

Expand Down
9 changes: 9 additions & 0 deletions projects/geo/src/lib/layer/shared/layer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ export class LayerService {
return;
}

if (
layerOptions.sourceOptions &&
layerOptions.sourceOptions.optionsFromCapabilities
) {
layerOptions = Object.assign(
layerOptions,
(layerOptions.source.options as any)._layerOptionsFromCapabilities
);
}
let layer;
switch (layerOptions.source.constructor) {
case OSMDataSource:
Expand Down

0 comments on commit e6efe73

Please sign in to comment.