File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,14 @@ QImage* QgsWMSServer::getLegendGraphics()
256
256
{
257
257
return 0 ;
258
258
}
259
+ if ( !mParameterMap .contains ( " LAYER" ) && !mParameterMap .contains ( " LAYERS" ) )
260
+ {
261
+ throw QgsMapServiceException ( " LayerNotSpecified" , " LAYER is mandatory for GetLegendGraphic operation" );
262
+ }
263
+ if ( !mParameterMap .contains ( " FORMAT" ) )
264
+ {
265
+ throw QgsMapServiceException ( " FormatNotSpecified" , " FORMAT is mandatory for GetLegendGraphic operation" );
266
+ }
259
267
260
268
QStringList layersList, stylesList;
261
269
@@ -1134,9 +1142,11 @@ int QgsWMSServer::configureMapRender( const QPaintDevice* paintDevice ) const
1134
1142
1135
1143
int QgsWMSServer::readLayersAndStyles ( QStringList& layersList, QStringList& stylesList ) const
1136
1144
{
1137
- // get layer and style lists from the parameters
1138
- layersList = mParameterMap .value ( " LAYERS" ).split ( " ," );
1139
- stylesList = mParameterMap .value ( " STYLES" ).split ( " ," );
1145
+ // get layer and style lists from the parameters trying LAYERS and LAYER as well as STYLE and STYLES for GetLegendGraphic compatibility
1146
+ layersList = mParameterMap .value ( " LAYER" ).split ( " ," );
1147
+ layersList = layersList + mParameterMap .value ( " LAYERS" ).split ( " ," );
1148
+ stylesList = mParameterMap .value ( " STYLE" ).split ( " ," );
1149
+ stylesList = stylesList + mParameterMap .value ( " STYLES" ).split ( " ," );
1140
1150
1141
1151
return 0 ;
1142
1152
}
You can’t perform that action at this time.
0 commit comments