Skip to content

Commit

Permalink
fix(layer): transform scale to resolution from wms getCapabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Jun 8, 2017
1 parent 36c04b4 commit 05e616f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib/datasource/shared/capabilities.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export class CapabilitiesService {
// defined under "alias" in the context
alias: layer.Title,
view: {
maxResolution: layer.MaxScaleDenominator ? Number(layer.MaxScaleDenominator) : Infinity,
minResolution: layer.MaxScaleDenominator ? Number(layer.MinScaleDenominator) : 8000,
maxResolution: this.getResolutionFromScale(layer.MaxScaleDenominator) || Infinity,
minResolution: this.getResolutionFromScale(layer.MinScaleDenominator) || 0
},
metadata: {
url: metadata ? metadata.OnlineResource : undefined
Expand Down Expand Up @@ -136,4 +136,9 @@ export class CapabilitiesService {
});
}

private getResolutionFromScale(scale: number): number {
const dpi = 25.4 / 0.28;
return scale/(39.37 * dpi);
}

}

0 comments on commit 05e616f

Please sign in to comment.