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:PropertyName>pcode</ogc:PropertyName>
          <ogc:Literal>3168</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;pcode&quot;= 
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 
text<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<http://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

Reply via email to