Skip to content

Commit

Permalink
Merge pull request #4466 from tbonfort/geometryColumnWFS
Browse files Browse the repository at this point in the history
[WFS] MapServer in WFS client mode doesn't allow setup the geometry column name for the filter request
  • Loading branch information
tbonfort committed Sep 24, 2012
2 parents f5fff71 + d351081 commit 2c93b6d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions mapows.h
Expand Up @@ -51,6 +51,7 @@ typedef struct {
char *pszService;
char *pszTypeName;
char *pszFilter;
char *pszGeometryName;
int nMaxFeatures;
char *pszBbox; /* only used with a Get Request */
char *pszOutputFormat; /* only used with DescibeFeatureType */
Expand Down
1 change: 1 addition & 0 deletions mapwfs.c
Expand Up @@ -2741,6 +2741,7 @@ void msWFSFreeParamsObj(wfsParamsObj *wfsparams)
free(wfsparams->pszTypeName);
free(wfsparams->pszFilter);
free(wfsparams->pszBbox);
free(wfsparams->pszGeometryName);
free(wfsparams->pszOutputFormat);
free(wfsparams->pszFeatureId);
free(wfsparams->pszSrs);
Expand Down
14 changes: 11 additions & 3 deletions mapwfslayer.c
Expand Up @@ -68,7 +68,7 @@ static wfsParamsObj *msBuildRequestParams(mapObj *map, layerObj *lp,
rectObj bbox;
const char *pszTmp;
int nLength, i = 0;
char *pszVersion, *pszTypeName = NULL;
char *pszVersion, *pszTypeName, *pszGeometryName = NULL;

if (!map || !lp || !bbox_ret)
return NULL;
Expand Down Expand Up @@ -114,6 +114,10 @@ static wfsParamsObj *msBuildRequestParams(mapObj *map, layerObj *lp,
}
*/

pszTmp = msOWSLookupMetadata(&(lp->metadata), "FO", "geometryname");
if (pszTmp)
psParams->pszGeometryName = msStrdup(pszTmp);

pszTmp = msOWSLookupMetadata(&(lp->metadata), "FO", "typename");
if (pszTmp)
psParams->pszTypeName = msStrdup(pszTmp);
Expand Down Expand Up @@ -214,6 +218,7 @@ static char *msBuildWFSLayerPostRequest(mapObj *map, layerObj *lp,
{
char *pszPostReq = NULL;
char *pszFilter = NULL;
char *pszGeometryName = "Geometry";
size_t bufferSize = 0;

if (psParams->pszVersion == NULL ||
Expand All @@ -231,6 +236,9 @@ static char *msBuildWFSLayerPostRequest(mapObj *map, layerObj *lp,
}


if (psParams->pszGeometryName) {
pszGeometryName = psParams->pszGeometryName;
}

if (psParams->pszFilter)
pszFilter = psParams->pszFilter;
Expand All @@ -239,12 +247,12 @@ static char *msBuildWFSLayerPostRequest(mapObj *map, layerObj *lp,
pszFilter = (char *)msSmallMalloc(bufferSize);
snprintf(pszFilter, bufferSize, "<ogc:Filter>\n"
"<ogc:BBOX>\n"
"<ogc:PropertyName>Geometry</ogc:PropertyName>\n"
"<ogc:PropertyName>%s</ogc:PropertyName>\n"
"<gml:Box>\n"
"<gml:coordinates>%f,%f %f,%f</gml:coordinates>\n"
"</gml:Box>\n"
"</ogc:BBOX>\n"
"</ogc:Filter>",bbox->minx, bbox->miny, bbox->maxx, bbox->maxy);
"</ogc:Filter>", pszGeometryName, bbox->minx, bbox->miny, bbox->maxx, bbox->maxy);
}

bufferSize = strlen(pszFilter)+500;
Expand Down

0 comments on commit 2c93b6d

Please sign in to comment.