WFS Filter

Yewondwossen Assefa assefa at DMSOLUTIONS.CA
Wed Apr 5 10:38:18 PDT 2006


You are right, the filter transforms it to an expression with a WHERE in 
front of it. This expression should then be used by the underlying 
driver when retreiving data. I am assuming that your are using ODBC to 
connect to the MS SQL server ?  The ODBC driver has the support of 
filter setting but I am not really familiar with what happen at the 
driver level.


Sture Dingsøyr wrote:
> Hi again and thanx for answer..
> 
> I have tried this (in my mapfile, displaying an GIF image):
> 
> If i use a regular mapserver filter expression, my layer gets correctly filtered. E.g: FILTER ('[servicename]' = 'Camping')
> 
> But if i use a SQL WHERE clause e.g. like this: FILTER "servicename = 'Camping'" no records are shown in my map.
> 
> I read that when using OGR and FILTER you should include "WHERE" in the filter (http://ms.gis.umn.edu/docs/howto/ogr_howto), so i tried that also: FILTER "WHERE servicename = 'Camping'". This time all the records are shown in the map.
> 
> So i guess the WFS FILTER transelates the XML into a WHERE clause, but i get the same result as with the WFS FILTER.... All records are returned...the filter expression is not "used"...?
> 
> Is this "a bug" or is this a feature that will be implemented later in Mapserver?
> 
> As mentioned before...this problem is only with OGR layers..not SHAPE, POSTGIS...
> 
> Regards
> Sture
> 
> 
> 
> The way things work is that the filter encoding  is transformed into something suitable for each layer and the layer's filter element is set with it :
>   * For shape file, It will be a normal mapserver expression,
>   * for postgis, oracle and ogr, it will be transformed into an sql expression. For OGR It should result into something like WHERE
> (Item_name='Item_Value')
> 
>   Bug http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1292 has more details on this.
> 
>   What you could try is to set manually a valid sql expression on you layer's filter and see if that works.
> 
> Later,
> 
> Sture Dingsøyr wrote:
> 
>>Hi all
>>
>>Been doing some testing with Mapserver WFS and FILTER.
>>
>>When the Mapserver layer is getting its data from e.g. SHAPE, POSTGRESQL the WFS FILTER functions seem to work fine.  I can filter data by using both BBOX or e.g. a PropertyIsLike query. 
>>
>>But...i was now testing the FILTER functions on a layer where the data is from a MS SQL server (point layer). I am fetching my data via OGR. Mapserver renders the layer just fine, i can use WFS BBOX FILTER, but when i try a WMS FILTER using e.g. WFS  PropertyIsLike query, Mapserver returns all records in the layer. Nothing gets filtered...
>>
>>Should not Mapserver (via WFS) filter data in the same way regardless 
>>of how the data is fetched...that is e.g. via SHAPE, POSTGRESQL, OGR 
>>etc
>>
>>Regards
>>Sture
> 
> 
> 


-- 
----------------------------------------------------------------
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