Merge pull request #11391 from mike-000/patch-8
Simplify scale calculation used for WMS getLegendUrl()
This commit is contained in:
@@ -247,9 +247,8 @@ class ImageWMS extends ImageSource {
|
||||
const mpu = this.getProjection()
|
||||
? this.getProjection().getMetersPerUnit()
|
||||
: 1;
|
||||
const dpi = 25.4 / 0.28;
|
||||
const inchesPerMeter = 39.37;
|
||||
baseParams['SCALE'] = resolution * mpu * inchesPerMeter * dpi;
|
||||
const pixelSize = 0.00028;
|
||||
baseParams['SCALE'] = (resolution * mpu) / pixelSize;
|
||||
}
|
||||
|
||||
assign(baseParams, params);
|
||||
|
||||
@@ -263,9 +263,8 @@ class TileWMS extends TileImage {
|
||||
const mpu = this.getProjection()
|
||||
? this.getProjection().getMetersPerUnit()
|
||||
: 1;
|
||||
const dpi = 25.4 / 0.28;
|
||||
const inchesPerMeter = 39.37;
|
||||
baseParams['SCALE'] = resolution * mpu * inchesPerMeter * dpi;
|
||||
const pixelSize = 0.00028;
|
||||
baseParams['SCALE'] = (resolution * mpu) / pixelSize;
|
||||
}
|
||||
|
||||
assign(baseParams, params);
|
||||
|
||||
@@ -369,7 +369,7 @@ describe('ol.source.ImageWMS', function () {
|
||||
expect(queryData.get('REQUEST')).to.be('GetLegendGraphic');
|
||||
expect(queryData.get('SERVICE')).to.be('WMS');
|
||||
expect(queryData.get('VERSION')).to.be('1.3.0');
|
||||
expect(queryData.get('SCALE')).to.be('357.14214285714274');
|
||||
expect(queryData.get('SCALE')).to.be('357.14285714285717');
|
||||
});
|
||||
|
||||
it('does not include SCALE if no resolution was provided', function () {
|
||||
@@ -405,7 +405,7 @@ describe('ol.source.ImageWMS', function () {
|
||||
expect(queryData.get('REQUEST')).to.be('GetLegendGraphic');
|
||||
expect(queryData.get('SERVICE')).to.be('WMS');
|
||||
expect(queryData.get('VERSION')).to.be('1.3.0');
|
||||
expect(queryData.get('SCALE')).to.be('357.14214285714274');
|
||||
expect(queryData.get('SCALE')).to.be('357.14285714285717');
|
||||
expect(queryData.get('STYLE')).to.be('STYLE_VALUE');
|
||||
expect(queryData.get('FEATURETYPE')).to.be('FEATURETYPE_VALUE');
|
||||
expect(queryData.get('RULE')).to.be('RULE_VALUE');
|
||||
|
||||
@@ -329,7 +329,7 @@ describe('ol.source.TileWMS', function () {
|
||||
expect(queryData.get('REQUEST')).to.be('GetLegendGraphic');
|
||||
expect(queryData.get('SERVICE')).to.be('WMS');
|
||||
expect(queryData.get('VERSION')).to.be('1.3.0');
|
||||
expect(queryData.get('SCALE')).to.be('357.14214285714274');
|
||||
expect(queryData.get('SCALE')).to.be('357.14285714285717');
|
||||
});
|
||||
|
||||
it('does not include SCALE if no resolution was provided', function () {
|
||||
@@ -365,7 +365,7 @@ describe('ol.source.TileWMS', function () {
|
||||
expect(queryData.get('REQUEST')).to.be('GetLegendGraphic');
|
||||
expect(queryData.get('SERVICE')).to.be('WMS');
|
||||
expect(queryData.get('VERSION')).to.be('1.3.0');
|
||||
expect(queryData.get('SCALE')).to.be('357.14214285714274');
|
||||
expect(queryData.get('SCALE')).to.be('357.14285714285717');
|
||||
expect(queryData.get('STYLE')).to.be('STYLE_VALUE');
|
||||
expect(queryData.get('FEATURETYPE')).to.be('FEATURETYPE_VALUE');
|
||||
expect(queryData.get('RULE')).to.be('RULE_VALUE');
|
||||
|
||||
Reference in New Issue
Block a user