Skip to content

Commit 65aafea

Browse files
Wms essential
1 parent f718f14 commit 65aafea

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

mapwmslayer.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,18 @@ int msDrawWMSLayerLow(int nLayerId, httpRequestObj *pasReqInfo,
12781278
int currentconnectiontype;
12791279
int numclasses;
12801280
char *mem_filename = NULL;
1281+
const char *pszTmp;
1282+
int bIsEssential;
1283+
1284+
/* ------------------------------------------------------------------
1285+
* Sometimes a requested layer is essential for the map, so if the
1286+
* request fails or an error is delivered, the map has not to be drawn
1287+
* ------------------------------------------------------------------ */
1288+
bIsEssential = MS_FALSE;
1289+
if ((pszTmp = msOWSLookupMetadata(&(lp->metadata),
1290+
"MO", "essential")) != NULL) {
1291+
bIsEssential = atoi(pszTmp);
1292+
}
12811293

12821294
/* ------------------------------------------------------------------
12831295
* Find the request info for this layer in the array, based on nLayerId
@@ -1297,23 +1309,28 @@ int msDrawWMSLayerLow(int nLayerId, httpRequestObj *pasReqInfo,
12971309
if ( !MS_HTTP_SUCCESS( pasReqInfo[iReq].nStatus ) ) {
12981310
/* ====================================================================
12991311
Failed downloading layer... we log an error but we still return
1300-
SUCCESS here so that the layer is only skipped intead of aborting
1312+
SUCCESS here so that the layer is only skipped instead of aborting
13011313
the whole draw map.
1314+
If the layer is essential the map is not to be drawn.
13021315
==================================================================== */
13031316
msSetError(MS_WMSERR,
13041317
"WMS GetMap request failed for layer '%s' (Status %d: %s).",
13051318
"msDrawWMSLayerLow()",
13061319
(lp->name?lp->name:"(null)"),
13071320
pasReqInfo[iReq].nStatus, pasReqInfo[iReq].pszErrBuf );
13081321

1309-
return MS_SUCCESS;
1322+
if (!bIsEssential)
1323+
return MS_SUCCESS;
1324+
else
1325+
return MS_FAILURE;
13101326
}
13111327

13121328
/* ------------------------------------------------------------------
13131329
* Check the Content-Type of the response to see if we got an exception,
13141330
* if yes then try to parse it and pass the info to msSetError().
13151331
* We log an error but we still return SUCCESS here so that the layer
1316-
* is only skipped intead of aborting the whole draw map.
1332+
* is only skipped instead of aborting the whole draw map.
1333+
* If the layer is essential the map is not to be drawn.
13171334
* ------------------------------------------------------------------ */
13181335
if (pasReqInfo[iReq].pszContentType &&
13191336
(strcmp(pasReqInfo[iReq].pszContentType, "text/xml") == 0 ||
@@ -1358,7 +1375,10 @@ int msDrawWMSLayerLow(int nLayerId, httpRequestObj *pasReqInfo,
13581375
"msDrawWMSLayerLow()",
13591376
(lp->name?lp->name:"(null)"), szBuf );
13601377

1361-
return MS_SUCCESS;
1378+
if (!bIsEssential)
1379+
return MS_SUCCESS;
1380+
else
1381+
return MS_FAILURE;
13621382
}
13631383

13641384
/* ------------------------------------------------------------------

0 commit comments

Comments
 (0)