Skip to content

Commit

Permalink
Move WMS filter execution (GetMap) to the end of the parameter proces…
Browse files Browse the repository at this point in the history
…sing function - after styles are processed.
  • Loading branch information
sdlime committed Dec 16, 2019
1 parent 8bd3d91 commit 54962c1
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions mapwms.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,6 @@ int msWMSLoadGetMapParams(mapObj *map, int nVersion,
epsgbuf[0]='\0';
srsbuffer[0]='\0';


/* Some of the getMap parameters are actually required depending on the */
/* request, but for now we assume all are optional and the map file */
/* defaults will apply. */
Expand Down Expand Up @@ -1035,9 +1034,6 @@ int msWMSLoadGetMapParams(mapObj *map, int nVersion,
request = values[i];
}




if (strcasecmp(names[i], "LAYERS") == 0) {
int j, k, iLayer, *layerOrder;
int nLayerOrder = 0;
Expand Down Expand Up @@ -1153,7 +1149,6 @@ int msWMSLoadGetMapParams(mapObj *map, int nVersion,
used with msLoadProjection and that does alreay the job */
/* snprintf(srsbuffer, 100, "init=epsg:%.20s", values[i]+5); */


snprintf(srsbuffer, sizeof(srsbuffer), "EPSG:%.20s",values[i]+5);
snprintf(epsgbuf, sizeof(epsgbuf), "EPSG:%.20s",values[i]+5);

Expand All @@ -1164,7 +1159,6 @@ int msWMSLoadGetMapParams(mapObj *map, int nVersion,
srsbuffer[strlen(srsbuffer)-1] = '\0';
if (epsgbuf[strlen(epsgbuf)-1] == ',')
epsgbuf[strlen(epsgbuf)-1] = '\0';

}

/* we need to wait until all params are read before */
Expand Down Expand Up @@ -1650,29 +1644,12 @@ this request. Check wms/ows_enable_request settings.",
}
}

/*
** Apply vendor-specific filter if specified
*/
if (filter) {
if (sld_url || sld_body) {
msSetError(MS_WMSERR,
"Vendor-specific FILTER parameter cannot be used with SLD or SLD_BODY.",
"msWMSLoadGetMapParams()");
return msWMSException(map, nVersion, NULL, wms_exception_format);
}

if (msWMSApplyFilter(map, nVersion, filter, need_axis_swap, wms_exception_format) == MS_FAILURE) {
return MS_FAILURE;/* msWMSException(map, nVersion, "InvalidFilterRequest"); */
}
}

if (sld_url || sld_body) {
int nLayersBefore, nLayerAfter;
char request_tmp[32];
char *pszLayerNames = NULL;
nLayersBefore = map->numlayers;


/* -------------------------------------------------------------------- */
/* if LAYERS parameter was not given, set all layers to off */
/* -------------------------------------------------------------------- */
Expand All @@ -1683,7 +1660,6 @@ this request. Check wms/ows_enable_request settings.",
}
}


/*apply sld if defined. This is done here so that bbox and srs are already applied*/
if (sld_url) {
if ((status = msSLDApplySLDURL(map, sld_url, -1, NULL, &pszLayerNames)) != MS_SUCCESS)
Expand Down Expand Up @@ -1734,6 +1710,7 @@ this request. Check wms/ows_enable_request settings.",
msFree(pszLayerNames);

}

/* Validate Styles :
** MapServer advertize styles through th group setting in a class object.
** If no styles are set MapServer expects to have empty values
Expand Down Expand Up @@ -1909,6 +1886,22 @@ this request. Check wms/ows_enable_request settings.",

}

/*
** Apply vendor-specific filter if specified
*/
if (filter) {
if (sld_url || sld_body) {
msSetError(MS_WMSERR,
"Vendor-specific FILTER parameter cannot be used with SLD or SLD_BODY.",
"msWMSLoadGetMapParams()");
return msWMSException(map, nVersion, NULL, wms_exception_format);
}

if (msWMSApplyFilter(map, nVersion, filter, need_axis_swap, wms_exception_format) == MS_FAILURE) {
return MS_FAILURE;/* msWMSException(map, nVersion, "InvalidFilterRequest"); */
}
}

return MS_SUCCESS;
}

Expand Down

0 comments on commit 54962c1

Please sign in to comment.