Opened 14 years ago
Last modified 14 years ago
#3235 new defect
WFS Server - GetFeature POST request does not return geometry
Reported by: | jbartkowiak | Owned by: | assefa |
---|---|---|---|
Priority: | normal | Milestone: | 5.6.4 release |
Component: | WFS Server | Version: | svn-trunk (development) |
Severity: | normal | Keywords: | WFS GetFeature |
Cc: | dmorissette |
Description
Playing with Gaia 3.4 viewer (which uses POST request to get WFS layer features), I found that WFS GetFeature POST request does not return msGeometry in output GML document. The problem is that if no <PropertyName> elements are specified, then all but msGeometry feature properties are returned, not all as should be. I did some investigation and I think that the bug is in POST request parser code, here is the patch:
*** D:/build/mapserver-buildkit-2008/mapserver-5.6.0-rc1/mapwfs.c Mon Nov 09 21:19:06 2009 --- D:/build/mapserver-buildkit-2008/mapserver-5.6.0/mapwfs.c Tue Dec 15 09:56:19 2009 *************** *** 2281,2288 **** pszTmp2= NULL; /*when there is no PropertyName, we outpout () so that it is parsed properly in GetFeature*/ ! if (psPropertyName == NULL) ! pszTmp2 = strdup(""); while (psPropertyName) { --- 2288,2295 ---- pszTmp2= NULL; /*when there is no PropertyName, we outpout () so that it is parsed properly in GetFeature*/ ! //if (psPropertyName == NULL) ! // pszTmp2 = strdup(""); while (psPropertyName) {
There is another one bug I noticed concerning WFS GetFeature GET request and PROPERTYNAME parameter. The example test request:
...&SERVICE=WFS&VERSION=1.0.0&REQUEST=!GetFeature&TYPENAME=Obreby&PROPERTYNAME=NR
results in this error message:
msWFSGetFeature(): WFS server error. Optional PROPERTYNAME parameter. A list of properties may be specified for each type name. Example TYPENAME=name1&name2&PROPERTYNAME=(prop1,prop2)(prop1)
This is my patch:
*** D:/build/mapserver-buildkit-2008/mapserver-5.6.0-rc1/mapwfs.c Mon Nov 09 21:19:06 2009 --- D:/build/mapserver-buildkit-2008/mapserver-5.6.0/mapwfs.c Tue Dec 15 09:56:19 2009 *************** *** 2113,2121 **** --- 2112,2128 ---- wfsparams->pszFeatureId = strdup(request->ParamValues[i]); else if (strcasecmp(request->ParamNames[i], "PROPERTYNAME") == 0) + { + if (request->ParamValues[i][0] != '(') + { + wfsparams->pszPropertyName = (char*)malloc(strlen(request->ParamValues[i] + 3)); + sprintf(wfsparams->pszPropertyName,"(%s)", request->ParamValues[i]); + } + else wfsparams->pszPropertyName = strdup(request->ParamValues[i]); } } + } /* version is optional is the GetCapabilities. If not */ /* provided, set it. Default it to 1.1.0*/ if (wfsparams->pszVersion == NULL &&
And the last minor bug (I think) in mapwfs.c I noticed. According to comments in msWFSDumpLayer() function instead of:
/* Map has no SRS. Use layer SRS or produce a warning. */ pszWfsSrs = msOWSGetEPSGProj(&(map->projection),&(map->web.metadata), "FO", MS_TRUE);
should be:
/* Map has no SRS. Use layer SRS or produce a warning. */ pszWfsSrs = msOWSGetEPSGProj(&(lp->projection),&(lp->metadata), "FO", MS_TRUE);
Attachments (1)
Change History (9)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Milestone: | 5.6 release → 5.6.1 release |
---|
The same behaviour on my project. GET syntax is OK, but GetFeature XML request POSTed to Mapserver 5.6.1 does not return msGeometry.
I am using MapServer version 5.6.1 on an RHEL 5 server (custom compilation).
comment:3 by , 14 years ago
Same situation here, Gentoo (x68) and MapServer 5.6.3, the problem appeared in OpenLayers (MapFish) environment: no returned msGeometry in WFS GetFeature replies.
Thanks for the patch, it worked well for me!
by , 14 years ago
Attachment: | mapserver_3235.0.patch added |
---|
comment:4 by , 14 years ago
Component: | MapServer C Library → WFS Server |
---|---|
Owner: | changed from | to
Same issue with the trunk (r10132): WFS GetFeature POST request does not return msGeometry.
applying attachment:mapserver_3235.0.patch fixes the problem
comment:5 by , 14 years ago
Cc: | added |
---|---|
Milestone: | 5.6.1 release → 5.6.4 release |
Owner: | changed from | to
comment:8 by , 14 years ago
Is this distributive package bug?
- OSGeo4W: 5.6.4 - fixed
- FWTools: 5.7-dev - still present
I did notice this behavior too while using OpenLayers. I created an OpenLayers.Layer.Vector object with the OpenLayers.Protocol.WFS Protocol. Examining the returned XML from the server, I found out that the msGeometry part was missing in the response for each feature in the layer.
I am using MapServer version 5.6.1 on an Ubuntu 8.04 server taken from the Ubuntu-GIS repository.