Skip to content

Commit

Permalink
Wms essential
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed May 4, 2020
1 parent f718f14 commit 65aafea
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions mapwmslayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,18 @@ int msDrawWMSLayerLow(int nLayerId, httpRequestObj *pasReqInfo,
int currentconnectiontype;
int numclasses;
char *mem_filename = NULL;
const char *pszTmp;
int bIsEssential;

/* ------------------------------------------------------------------
* Sometimes a requested layer is essential for the map, so if the
* request fails or an error is delivered, the map has not to be drawn
* ------------------------------------------------------------------ */
bIsEssential = MS_FALSE;
if ((pszTmp = msOWSLookupMetadata(&(lp->metadata),
"MO", "essential")) != NULL) {
bIsEssential = atoi(pszTmp);
}

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

return MS_SUCCESS;
if (!bIsEssential)
return MS_SUCCESS;
else
return MS_FAILURE;
}

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

return MS_SUCCESS;
if (!bIsEssential)
return MS_SUCCESS;
else
return MS_FAILURE;
}

/* ------------------------------------------------------------------
Expand Down

0 comments on commit 65aafea

Please sign in to comment.