[Geoserver-devel] WMS and filters, first implementation broken

Hi all,
I'm seeking advice on how to fix the filter parameter in WMS
request. At the moment the separator is a comma, but this has
issues with all filters that do use it in their specification,
for example the bbox one:

<ogc:BBOX>
         <ogc:PropertyName>the_geom</ogc:PropertyName>
         <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
            <gml:coordinates>-75.102613,40.212597 -72.361859,41.512517</gml:coordinates>
         </gml:Box>
       </ogc:BBOX>

Well, I don't think there is any separator that will do...
We probably have to use a full xml document instead, something
like:

<FilterList>
   <Filter>
      <!-- first filter -->
   </Filter>
   <Filter/> <!-- do not filter the second layer -->
</FilterList>

What do you think?
Cheers
Andrea

It should be the same as WFS?

Hrm, looking at the code there's some duplication of effort and it's not doing the full filter parser like I was imagining.

Sorry, I'm sure I wasn't explicit enough.

First off, WFS delimits filters with ( and ) around each one:

'Parentheses may also be used to delimit multiple local filters when more than one feature type is specified for the TYPENAME parameter. The following URL fragment shows how this may be done:
typename=FEAT1,FEAT2&filter=(<Filter>…FEAT1filter…</Filter>)(<Filter>…FEAT2filter…</Filter>)'
(from the spec)

Additionally I also thinking the WMS would be able to take the special KVP filters of WFS, which are the most useful - FeatureID=roads.33453 and BBOX=0,0,43,56. Though on second thought BBOX is redundant since it's already in WMS. And featureid isn't all that useful, to just display one feature.

But in my mind it'd be trivial to pick them up, because you'd use:
https://svn.codehaus.org/geoserver/trunk/wfs/src/main/java/org/vfny/geoserver/wfs/requests/WfsKvpRequestReader.java
whose only method is readFilters. Perhaps just moving it up a level to KvpRequestReader or a OWSRequestReader may not be the best thing, since you'll get the conflict with BBOX. But it would probably be good to duplicate less code. And it also shows how to use the () delimiter.

Also, sometime we should do a cleanup of our packages. The utility stuff that is shared between different places is hard to find. And some of it's just in wrong places, like the WfsKvpRequestReader should at least be in the readers/ sub-package. But I think handlers should also get their own package, since now they're just mixed in with the request objects. And maybe separate Xml and KVP readers (though that might be a bit much...). But just when I'm trying to find stuff I'm often confused, it took me awhile to figure out all the sub and super class locations for the kvp readers.

Chris

Andrea Aime wrote:

Hi all,
I'm seeking advice on how to fix the filter parameter in WMS
request. At the moment the separator is a comma, but this has
issues with all filters that do use it in their specification,
for example the bbox one:

<ogc:BBOX>
         <ogc:PropertyName>the_geom</ogc:PropertyName>
         <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
            <gml:coordinates>-75.102613,40.212597 -72.361859,41.512517</gml:coordinates>
         </gml:Box>
       </ogc:BBOX>

Well, I don't think there is any separator that will do...
We probably have to use a full xml document instead, something
like:

<FilterList>
   <Filter>
      <!-- first filter -->
   </Filter>
   <Filter/> <!-- do not filter the second layer -->
</FilterList>

What do you think?
Cheers
Andrea

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:1003,45b226e394951665516417!

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org

Chris Holmes ha scritto:

It should be the same as WFS?

Hrm, looking at the code there's some duplication of effort and it's not doing the full filter parser like I was imagining.

Sorry, I'm sure I wasn't explicit enough.

First off, WFS delimits filters with ( and ) around each one:

'Parentheses may also be used to delimit multiple local filters when more than one feature type is specified for the TYPENAME parameter. The following URL fragment shows how this may be done:
typename=FEAT1,FEAT2&filter=(<Filter>…FEAT1filter…</Filter>)(<Filter>…FEAT2filter…</Filter>)'

(from the spec)

I did try it to begin with, but wasn't working properly, don't know why... then again, I'm not sure our parsing is handling the same
problem I had with commas, in parenthesis version.
What if I setup a filter with an equality condition between a string
property and "(xxx"?

Cheers
Andrea

I can think of a couple of ways to handle that case:

1. Force users using multiple filters to escape parens inside any compound filter. <Literal>(xxx</Literal> becomes <Literal>\(xxx</Literal>

2. Allow users to OPTIONALLY specify a non-standard filter delimiter:

http://long-wms-request&filterdelimiters={}&filter={filter1}{filter2}{filter3}

By default (which will be acceptable to 99.99% of filters) the filterdelimiters parameter is set to ().

--saul

Andrea Aime wrote:

Chris Holmes ha scritto:

It should be the same as WFS?

Hrm, looking at the code there's some duplication of effort and it's not doing the full filter parser like I was imagining.

Sorry, I'm sure I wasn't explicit enough.

First off, WFS delimits filters with ( and ) around each one:

'Parentheses may also be used to delimit multiple local filters when more than one feature type is specified for the TYPENAME parameter. The following URL fragment shows how this may be done:
typename=FEAT1,FEAT2&filter=(<Filter>…FEAT1filter…</Filter>)(<Filter>…FEAT2filter…</Filter>)'

(from the spec)

I did try it to begin with, but wasn't working properly, don't know why... then again, I'm not sure our parsing is handling the same
problem I had with commas, in parenthesis version.
What if I setup a filter with an equality condition between a string
property and "(xxx"?

Cheers
Andrea

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel