Re: [mapserver-users] WFS filter creates a query using a number instead of text
Mapserver 7 beta solved this issue.At least for my use cases.. with and without using gml_[item name]_type John Abraham j...@hbaspecto.com@lists.osgeo.org Envoyé par : mapserver-users-boun...@lists.osgeo.org 2015-02-27 09:05 A Rahkonen Jukka (MML) jukka.rahko...@maanmittauslaitos.fi cc mapserver-users@lists.osgeo.org mapserver-users@lists.osgeo.org, bte...@gmail.com bte...@gmail.com Objet Re: [mapserver-users] WFS filter creates a query using a number instead of text On Feb 26, 2015, at 11:55 PM, Rahkonen Jukka (MML) jukka.rahko...@maanmittauslaitos.fi wrote: You can also try to add gml_[item name]_type into the layer metadata I have to add gml_[item name]_type in all my map files, to make them work as wfs in my context. -- John Abraham Sent from my iPhone, please excuse any typos. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] WFS filter creates a query using a number instead of text
Thanks Jukka - I'll try your suggestion for OGR connection-type first, since that's easy for me to test on our existing platform. I have tried the PropertyIsLike and that definitely works. It'll take me a little bit longer to spin up a more recent version of the software packages... Regards, Bill. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/WFS-filter-creates-a-query-using-a-number-instead-of-text-tp5130361p5190806.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] WFS filter creates a query using a number instead of text
Hi Jukka - I've tried testing your other suggestion: OK - I've tried using the OGR CONNECTIONTYPE - it no longer generates an error message, but comes back with a null result set. Checking the logs reveals that the error is now apparently being pushed further back up the stack - eg the Postgres logs are clear (strangely) but the MapServer debug log reports an error as follows: I guess effectively the same error as before - there's no quoting in the string literal (not sure why the Postgres log shouldn't still report this error...?) Testing the OGR config with WFS operator PropertyIsLike, works (as did the PostGIS driver.) I think I'll use this method for the moment as it will work with our production system. Thanks again! Steve - good to know that v7 works. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/WFS-filter-creates-a-query-using-a-number-instead-of-text-tp5130361p5190809.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] WFS filter creates a query using a number instead of text
On Feb 26, 2015, at 11:55 PM, Rahkonen Jukka (MML) jukka.rahko...@maanmittauslaitos.fi wrote: You can also try to add gml_[item name]_type into the layer metadata I have to add gml_[item name]_type in all my map files, to make them work as wfs in my context. -- John Abraham Sent from my iPhone, please excuse any typos.___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] WFS filter creates a query using a number instead of text
Hi, I would recommend to make a test with Mapserver 7.0-beta and GDAL 1.11.2 or at least with 6.4 and 1.10. Your case does feel like an obvious bug but Mapserver 6.0.3 or GDAL 1.8.0 are out of maintenance. I have some ideas for workarounds: You can try if it makes difference to use either the native PostGIS driver or GDAL OGR driver (CONNECTIONTYPW OGR). You can also try to add gml_[item name]_type into the layer metadata http://mapserver.org/ogc/wfs_server.html but I do not know if Mapserver 6.0 supports it and probably it does not change anything because your schema is good already. And perhaps using PropertyIsLike instead of PropertyIsEqualTo could work. -Jukka Rahkonen- bteluk wrote: I can't shine any light on the problem but I have encountered the same problem. Using MapServer v6.0.3, with Postgres 9.1.3, PostGIS v 1.5.3, GDAL v1.8.0. WFS Posted Query looks like this: wfs:GetFeature service=WFS version=1.0.0 wfs=http://www.opengis.net/wfs; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd; wfs:Query typeName=PostCodeArea ogc:Filter ogc:PropertyIsEqualTo ogc:PropertyNamepcode/ogc:PropertyName ogc:Literal3168/ogc:Literal /ogc:PropertyIsEqualTo /ogc:Filter /wfs:Query /wfs:GetFeature The DescribeFeatureType for that layer shows the following for the attribute: element name=pcode type=string/ PostgreSQL has the attribute field specified as a string: pcode | character varying(10) | Server responds: ?xml version='1.0' encoding=ISO-8859-1 ? ServiceExceptionReport version=1.2.0 xmlns=http://www.opengis.net/ogc; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://www.opengis.net/ogc http://schemas.opengis.net//wfs/1.0.0/OGC-exception.xsd; ServiceException code=NoApplicableCode locator=mapserv msWFSGetFeature(): WFS server error. FLTApplyFilterToLayer() failed msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: operator does not exist: character varying = integer LINE 1: ...90 -5,165 -5,165 -50,90 -50))#39;,4283) and ( (quot;pcodequot;= 3168) ) ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. /ServiceException /ServiceExceptionReport Postgres Log shows: 2015-02-27 16:11:42.394 EST gecli 127.0.0.1(41368)ERROR: operator does not exist: character varying = integer at character 250 2015-02-27 16:11:42.394 EST gecli 127.0.0.1(41368)HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. 2015-02-27 16:11:42.394 EST gecli 127.0.0.1(41368)STATEMENT: select gid,source,ufi,area,pcode,perimeter,encode(ST_AsBinary(ST_Force_2D(the_geom),'NDR'),'hex') as geom,gid from sensis.postcode where the_geom ST_GeomFromText('POLYGON((90 -50,90 -5,165 -5,165 -50,90 -50))',4283) and ( (pcode= 3168) ) $ Certainly appears that the query put to PostGIS is incorrect - it's not quoting the literal value. I have a similar MapServer layer that's based on ESRI Shapefile - same effective attribute set up, and it works fine - of course it's not going via PostgreSQL/PostGIS - so it seems that the problem is specific to the PostgreSQL/PostGIS interface? I tried mucking around with including PostgreSQL casts on the literal eg. 3168::text, using CAST(pcode as int) on the PropertyName etc with no luck. Using PropertyIsLike did work, but is not an ideal solution. View this message in context: Re: WFS filter creates a query using a number instead of texthttp://osgeo-org.1560.x6.nabble.com/WFS-filter-creates-a-query-using-a-number-instead-of-text-tp5130361p5190393.html Sent from the Mapserver - User mailing list archivehttp://osgeo-org.1560.x6.nabble.com/Mapserver-User-f4226646.html at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] WFS filter creates a query using a number instead of text
I can't shine any light on the problem but I have encountered the same problem. Using MapServer v6.0.3, with Postgres 9.1.3, PostGIS v 1.5.3, GDAL v1.8.0.WFS Posted Query looks like this:The DescribeFeatureType for that layer shows the following for the attribute:PostgreSQL has the attribute field specified as a string:Server responds:Postgres Log shows:Certainly appears that the query put to PostGIS is incorrect - it's not quoting the literal value.I have a similar MapServer layer that's based on ESRI Shapefile - same effective attribute set up, and it works fine - of course it's not going via PostgreSQL/PostGIS - so it seems that the problem is specific to the PostgreSQL/PostGIS interface?I tried mucking around with including PostgreSQL casts on the literal eg. 3168::text, using CAST(pcode as int) on the PropertyName etc with no luck. Using PropertyIsLike did work, but is not an ideal solution. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/WFS-filter-creates-a-query-using-a-number-instead-of-text-tp5130361p5190393.html Sent from the Mapserver - User mailing list archive at Nabble.com.___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] WFS filter creates a query using a number instead of text
The problem is when we send a string that represents a number, example: Filter=FilterPropertyIsEqualToPropertyNamecode_cs /PropertyNameLiteral864000/Literal/PropertyIsEqualTo/Filter I get: ERROR: operator does not exist: character varying = integer code_cs= 864000 DescribeFeatureType returns element name=code_cs type=string / In posgis, code_cs is defined as character varying(18) My workaround is using Like instead of EqualTo Filter=FilterPropertyIsLike wildcard='*' singleChar='.' escape='!'PropertyNamecode_cs/PropertyNameLiteral864000/Literal/PropertyIsLike/Filter Is this a bug in mapserver, creating the query using a number, even if DescribeFeatureType returns 'string' as type? thanks Steve ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users