[mapserver-dev] WFS query and Postgis cast problem using with filter encoding

Yewondwossen Assefa yassefa at dmsolutions.ca
Sat Dec 11 08:45:11 EST 2010


Hi,

You could possibly try to set a layer level metadata to indicate the type:
  "gml_code_dept_type" "Character"

Please also indicate what version of MapServer.

best regards,

On 10/12/2010 8:00 PM, Thomas Gratier wrote:
> Hello list,
>
> Filter encoding seems to suffer from a type problem with Postgis. I 
> want to confirm the problem and check I don't miss something.
>
> So my use case.
> I have created a Postgis table.
> The structure of the table starts with
>
> CREATE TABLE departement
> (
>   gid serial NOT NULL,
>   id_geofla numeric(10,0),
>   code_dept character varying(2),
>   nom_dept character varying(30),
>   the_geom geometry,
> ....
>
> I use this postgis layer in a WFS webservices
> A query like 
> http://localhost/cgi-bin/mapserv?map=/home/test/SIG/france/mapfiles/mapfile_carte.map&REQUEST=GetFeature&SERVICE=WFS&VERSION=1.0.0&TYPENAME=departements&OUTPUT=gml 
> <http://localhost/cgi-bin/mapserv?map=/home/test/SIG/france/mapfiles/mapfile_carte.map&REQUEST=GetFeature&SERVICE=WFS&VERSION=1.0.0&TYPENAME=departements&OUTPUT=gml> 
> works.
>
> When I use a filter like
> http://localhost/cgi-bin/mapserv?map=/home/test/SIG/france/mapfiles/mapfile_carte.map&REQUEST=GetFeature&SERVICE=WFS&VERSION=1.0.0&TYPENAME=departements&OUTPUT=gml&Filter= 
> <http://localhost/cgi-bin/mapserv?map=/home/test/SIG/france/mapfiles/mapfile_carte.map&REQUEST=GetFeature&SERVICE=WFS&VERSION=1.0.0&TYPENAME=departements&OUTPUT=gml&Filter=><Filter><PropertyIsEqualTo><PropertyName>code_dept</PropertyName><Literal>01</Literal></PropertyIsEqualTo></Filter>
> there is an error with the message below.
> <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 (ERREUR: l'opérateur 
> n'existe pas : character varying = integer LINE 1: 
> ...d_srid('','departement','the_geom')) and ( (code_dept= 01) ) ^ 
> HINT: Aucun opérateur ne correspond au nom donné et aux types 
> d'arguments. Vous devez ajouter des conversions explicites de type. ) 
> executing query: select 
> "gid","id_geofla","code_dept","nom_dept",encode(AsBinary(force_collection(force_2d("the_geom")),'NDR'),'hex') 
> as geom,"oid" from departement where the_geom && 
> GeomFromText('POLYGON((-25000000 -25000000,-25000000 25000000,25000000 
> 25000000,25000000 -25000000,-25000000 
> -25000000))',find_srid('','departement','the_geom')) and ( (code_dept= 
> 01) )
> </ServiceException>
> </ServiceExceptionReport>
>
> It seems to come from cast : mapserver receives the parameter from the 
> url but doesn't check type and considers the retrieved value as an 
> integer (because there is no quotes)
> This problem occurs with Postgis but not with a shapefile (the same 
> url works...). I've done some test with oid = true but nothing changes too
>
> Regards
>
> ThomasG
>
>
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev


-- 
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: yassefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20101211/44378ac2/attachment.html


More information about the mapserver-dev mailing list