[mapserver-users] Mapserver <ogc:Filter> fails against Geoserver WFS

Michal Šrédl michal.sredl at gmail.com
Mon Jan 9 04:08:38 EST 2012


Thanks Andreas,

I tried to provide the complete filter with leading <ogc:Filter
xmlns:ogc="http://www.opengis.net/ogc"> tag and I had to cut it away
manually to make it work at least against another mapserver.  Yes, I
can try to use <Filter> tag. I belive it can work against Geoserver.
But I already do know that it would not work against Intergraph
server. E.g. the following request can be broken by taking the
namespaces away:

http://portal.ingr.briseide.eu/TRACASA_VD12_WFS/wfservice.aspx?request=getfeature&service=wfs&version=1.1.0&typename=CATAST_POL_SUBPARURBA&filter=<ogc:Filter+xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyIsLessThan+xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyName>PARCELA</ogc:PropertyName><ogc:Literal>200</ogc:Literal></ogc:PropertyIsLessThan></ogc:Filter>

I don't dare to blame Intergraph in this case, as they are just
following FES and XML standards. I tried to use POST instead of GET,
and this is what I saw:

<?xml version="1.0" ?>
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2">
  <wfs:Query typeName="ccss:Flood2010_FloodActivityGrade">
    <ogc:Filter>
      <ogc:PropertyIsEqualTo
xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyName>STUPEN</ogc:PropertyName><ogc:Literal>3</ogc:Literal></ogc:PropertyIsEqualTo>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

As you can see, this is again not a vaild XML as it does not define
the namespaces. Mapserver doesn't mind, but other servers are using
standard XML libraries to parse it and they can not.

Best Regards,

Michal


2012/1/9 Eichner, Andreas - SID-NLKM <Andreas.Eichner at sid.sachsen.de>:
>
> At least in version 6.0.1 MapServer checks if a <Filter> or <ogc:Filter> tag was given in wfs_filter metadata and uses this. So you should be able to use <Filter> without a namespace prefix.
>
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: mapserver-users-bounces at lists.osgeo.org
>> [mailto:mapserver-users-bounces at lists.osgeo.org] Im Auftrag
>> von Michal Šrédl
>> Gesendet: Freitag, 6. Januar 2012 10:52
>> An: mapserver-users at lists.osgeo.org
>> Cc: Premysl Vohnout; Jachym Cepicky
>> Betreff: [mapserver-users] Mapserver <ogc:Filter> fails
>> against Geoserver WFS
>>
>> Dear all,
>>
>> I am not able to use WFS filter in Mapserver Mapfile against the
>> Geoserver WFS, apparently as Mapserver produces invalid XML as the
>> final filter that goes to the request.
>>
>> In Mapfile, I say
>>
>> LAYER
>>   METADATA
>>       "wfs_filter"  '<ogc:PropertyIsEqualTo
>> xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyName>STUPE
> N</ogc:PropertyName><ogc:Literal>3</ogc:Literal></ogc:PropertyIsEqualTo>'
>>
>> (the whole Mapfile is attached)
>>
>> The request that leaves Mapserver towards the Geoserver WFS
>> looks like this:
>>
>> http://88.81.191.230:8080/geoserver/ows?&REQUEST=GetFeature&VE
>> RSION=1.0.0&SERVICE=WFS&TYPENAME=ccss:Flood2010_FloodActivityG
> rade&FILTER=<ogc:Filter><ogc:PropertyIsEqualTo+xmlns:ogc="http://www.opengis.net/ogc"><og> c:PropertyName>STUPEN</ogc:PropertyName><ogc:Literal>3</ogc:Li
> teral></ogc:PropertyIsEqualTo></ogc:Filter>
>>
>> Please note the <ogc:Filter> filter tag - with namespace used, but not
>> defined. This is an issue, as it is not valid and Geoserver replies
>> with an exception.
>>
>> Changing manually the filter tag either to <Filter> or
>> <ogc:Filter+xmlns:ogc="http://www.opengis.net/ogc"> makes the whole
>> thing work. Unfortunately, the Mapserver documentation [1] says, that
>>
>> "The filter given as a value of the wfs_filter metadata should not
>> contain <Filter> start and end tags."
>>
>> So whatever I provide as the "wfs_filter" value, is later broken by
>> <ogc:Filter> tag.
>>
>> Do you consider it a bug? Or is there any way how to make Mapserver to
>> create the filter as valid XML? Or let me include the <Filter> tag in
>> the "wfs_filter"?
>>
>> Thank you for your advice,
>>
>> Michal
>>
>>
>> Note: Mapserver itself wouldn't mind such a behaviour and would accept
>> such a request, e.g. this one:
>>
>> http://bnhelp.cz/cgi-bin/crwfs/cgi-bin/crwfs?&REQUEST=GetFeatu
>> re&VERSION=1.0.0&SERVICE=WFS&TYPENAME=okresy&FILTER=<ogc:Filte
> r><ogc:PropertyIsLessThan+xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyName>> KODOK</ogc:PropertyName><ogc:Literal>3555</ogc:Literal></ogc:P
>> ropertyIsLessThan></ogc:Filter>
>>
>> But Geoserver is not that tolerant...
>>
>>
>> [1] http://mapserver.org/ogc/filter_encoding.html
>>
>


More information about the mapserver-users mailing list