Skip to content
Permalink
Browse files

Move WMS filter execution (GetMap) to the end of the parameter proces…

…sing function - after styles are processed.
  • Loading branch information
sdlime committed Nov 18, 2019
1 parent 8bd3d91 commit 54962c126c3ec55015fd3ec977aca14f59276f07
Showing with 17 additions and 24 deletions.
  1. +17 −24 mapwms.c
@@ -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. */
@@ -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;
@@ -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);

@@ -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 */
@@ -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 */
/* -------------------------------------------------------------------- */
@@ -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)
@@ -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
@@ -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;
}

0 comments on commit 54962c1

Please sign in to comment.
You can’t perform that action at this time.