Yeah, you're using the filter wrong. A function can't just be used
there,
it has to be the result of something? A function is an expression, so
has
to be used in a filter. Like:
<Filter>
<PropertyIsEqualTo>
<Functionname="SIN">
<PropertyName>DISPERSION_ANGLE</PropertyName>
</Function>
<Literal>1</Literal>
</PropertyIsEqualTo>
</Filter>
Thanks for the response. Wrapping the Function in a PropertyIsEqualTo
with a Literal 'true' as the second argument throws the same error as
just using the Function on its own. I did read in the FE spec that an
expression can't be a child of Filter, but Geoserver does (incorrectly?)
accept one. The following two Filters return all values in Geoserver:
<wfs:Query typeName="topp:TouchingPolygons">
<Filter>
<Literal>true</Literal>
</Filter>
</wfs:Query>
and:
<wfs:Query typeName="topp:TouchingPolygons">
<Filter>
<Function name="isValid">
<PropertyName>the_geom</PropertyName>
</Function>
</Filter>
</wfs:Query>
A valid (but lame) option should be to just wrap the expression in two
nested <Not> elements like this:
<wfs:Query typeName="topp:TouchingPolygons">
<Filter>
<Not>
<Not>
<Function name="isValid">
<PropertyName>the_geom</PropertyName>
</Function>
</Not>
</Not>
</Filter>
</wfs:Query>
but Geoserver doesn't like this at all (IndexOutOfBoundsException).
Perhaps there's an issue with the GML parsing in Functions, as the
following two Queries should return identical results, but the first
operates correctly while the second throws a NPE:
Works:
<wfs:Query typeName="topp:TouchingPolygons">
<Filter>
<Intersects>
<PropertyName>the_geom</PropertyName>
<gml:MultiPolygon
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates decimal="." cs="," ts=" ">-1,-1 -1,1
1,1 1,-1 -1,-1</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
</gml:MultiPolygon>
</Intersects>
</Filter>
</wfs:Query>
NPE:
<wfs:Query typeName="topp:TouchingPolygons">
<Filter>
<Function name="intersects">
<PropertyName>the_geom</PropertyName>
<gml:MultiPolygon
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates decimal="." cs="," ts=" ">-1,-1 -1,1
1,1 1,-1 -1,-1</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
</gml:MultiPolygon>
</Function>
</Filter>
</wfs:Query>
For now I'll use Intersects And Not Touches instead of
Relates(T********). Perhaps I'll load up Geoserver / Geotools into
eclipse and root around a bit for the problem (if I can summon the
activation energy). The Filter parser is a bit of a bear...
John