WFS Filters in MapServer
Yewondwossen Assefa
assefa at DMSOLUTIONS.CA
Wed May 16 11:42:44 PDT 2007
Hi There,
Could you quickly add a filter element in your layer, something like
the following
LAYER
NAME CustomPOI
STATUS OFF
TYPE POINT
FILTER "WHERE (oid = 305)"
...
This should be the result of your query with the filter. You can just
do the a simple query without a filter encoding and see if that works.
If this works I would be willing to check it provided that I can
replicate it her.
Later,
Jackey Cheung wrote:
> 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!
>
--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst
Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/
Phone: (613) 565-5056 (ext 14)
Fax: (613) 565-0925
----------------------------------------------------------------
More information about the MapServer-users
mailing list