WFS Filters in MapServer

Jackey Cheung cheung.jackey at GMAIL.COM
Tue May 15 21:22:39 EDT 2007


Hi all!

I'm setting up a WFS server with. It works fine while querying the server without any filter, but when I put in some filter, it always returns an exception: "msOGRFileNextShape(): OGR error. Not enough tokens to complete expression."

The map file looks like:
MAP
......
......
......

 WEB
  MINSCALE   2500
  MAXSCALE   85000000

  HEADER    "header.html"
  FOOTER    "footer.html"
  TEMPLATE   "map.html"

  IMAGEPATH   "/map/tmp/ms_tmp/"
  IMAGEURL   "/ms_tmp/"

  METADATA
   "wms_title"      "World"
   "wms_onlineresource" "http://192.168.0.10:8080/cgi-bin/mapserv?map=/map/maps/en/world.map&"
   "wms_srs"       "EPSG:4326"
   "wfs_title"            "GMap WFS Demo Server"  ## REQUIRED
   "wfs_onlineresource"   "http://192.168.0.10:8080/cgi-bin/mapserv?map=/map/maps/en/world.map&"  ## Recommended
   "wfs_srs"               "EPSG:4326"  ## Recommended
  END
 END

......
......

  LAYER
  NAME       CustomPOI
  STATUS     OFF

  TYPE       POINT
  CONNECTIONTYPE  OGR
  CONNECTION   "<OGRVRTDataSource>
       <OGRVRTLayer name='gdhk_poi'>
        <SrcDataSource>
         MYSQL:MapSQL,user=xxxxxx,password=000000,host=192.168.0.8,port=3306,tables=ud
        </SrcDataSource>
        <SrcSQL>
         SELECT oid, geom, name, poi_type, description FROM ud
        </SrcSQL>
        <GeometryType>wkbPoint</GeometryType>
       </OGRVRTLayer>
       </OGRVRTDataSource>"
  DATA       "gdhk_poi"
  UNITS       METERS
  METADATA
  "wfs_title"   "CustomPOI"
  "gml_featureid" "oid"
  "wfs_featureid" "oid"
  "gml_include_items" "all"
  #"wfs_filter"    "<PropertyIsEqualTo><PropertyName>oid</PropertyName><Literal>304</Literal></PropertyIsEqualTo>"
 END
 DUMP TRUE
 END

......
......

END


And the query looks like:
<?xml version="1.0" encoding="UTF-8"?>
<wfs:GetFeature service="WFS" maxFeatures="6" version="1.0.0"
  outputFormat="GML2"
  xmlns:wfs="http://www.opengis.net/wfs"
  xmlns:ogc="http://www.opengis.net/ogc"
  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-basic.xsd">
  <wfs:Query typeName="CustomPOI" >
   <ogc:Filter>
    <ogc:PropertyIsEqualTo >
     <ogc:PropertyName>oid</ogc:PropertyName>
     <ogc:Literal>305</ogc:Literal>
    </ogc:PropertyIsEqualTo>
  </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>


Besides the above, I've tried WFS clients like MapInfo, but whenever I use filter, the same exception is returned.

Please help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070516/c0ff068a/attachment.html


More information about the mapserver-users mailing list