getGetLegendRequestUrl accepts a LAYER parameter now
This commit is contained in:
committed by
Simon Seyock
parent
b2885e86fb
commit
89e8d6d693
@@ -219,15 +219,15 @@ class TileWMS extends TileImage {
|
||||
*
|
||||
* @param {number} [resolution] Resolution. If set to undefined, `SCALE`
|
||||
* will not be calculated and included in URL.
|
||||
* @param {Object} [params] GetLegendGraphic params. Default `FORMAT` is
|
||||
* `image/png`. `VERSION` should not be specified here.
|
||||
* @param {Object} [params] GetLegendGraphic params. If `LAYER` is set, the
|
||||
* request is generated for this wms layer, else it will try to use the
|
||||
* configured wms layer. Default `FORMAT` is `image/png`.
|
||||
* `VERSION` should not be specified here.
|
||||
* @return {string|undefined} GetLegendGraphic URL.
|
||||
* @api
|
||||
*/
|
||||
getLegendUrl(resolution, params) {
|
||||
const layers = this.params_.LAYERS;
|
||||
const isSingleLayer = !Array.isArray(layers) || this.params_['LAYERS'].length === 1;
|
||||
if (this.urls[0] === undefined || !isSingleLayer) {
|
||||
if (this.urls[0] === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -235,10 +235,18 @@ class TileWMS extends TileImage {
|
||||
'SERVICE': 'WMS',
|
||||
'VERSION': DEFAULT_WMS_VERSION,
|
||||
'REQUEST': 'GetLegendGraphic',
|
||||
'FORMAT': 'image/png',
|
||||
'LAYER': layers
|
||||
'FORMAT': 'image/png'
|
||||
};
|
||||
|
||||
if (params === undefined || params['LAYER'] === undefined) {
|
||||
const layers = this.params_.LAYERS;
|
||||
const isSingleLayer = !Array.isArray(layers) || layers.length === 1;
|
||||
if (!isSingleLayer) {
|
||||
return undefined;
|
||||
}
|
||||
baseParams['LAYER'] = layers;
|
||||
}
|
||||
|
||||
if (resolution !== undefined) {
|
||||
const mpu = this.getProjection() ? this.getProjection().getMetersPerUnit() : 1;
|
||||
const dpi = 25.4 / 0.28;
|
||||
|
||||
Reference in New Issue
Block a user