I have a feature collection that follows the generic structure displayed below:

      <StartTime delay="0">2017-10-18T04:10:00Z</StartTime>
      <StartTime delay="0">2017-10-18T02:10:00Z</StartTime>

I would like use an XPath filter that will select features whose StartTime was at a specific time, regardless of the type of activity. I've come up with a simple XPath that will target any element named StartTime


Which lead me to try the following fes Filter:

<fes:Filter xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:om="http://www.opengis.net/om/2.0"  xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Which results in an exception being thrown from Geoserver.

<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://internal.geoserver.local/geoserver/schemas/ows/1.1.0/owsAll.xsd">
    <ows:Exception exceptionCode="NoApplicableCode">
        <ows:ExceptionText>java.lang.StringIndexOutOfBoundsException: String index out of range: 0
String index out of range: 0</ows:ExceptionText>

Is there a way to perform these relative XPath expression filters in Geoserver?

I have tried not including the leading '//', but I then get an empty feature collection back from geoserver. Essentially it is unable to find the attribute I am attempting to filter on.

1 Answer 1


As far as I know, that is not supported, nor required to be supported. A WFS 2.0 compliant service is only required to support a very small subset of the XPath language, from the Filter 2.0 specification:

"This International Standard does not require that a filter expression processor support the full XPath language. In order to keep the implementation entry cost as low as possible, services that implement this specification and require the use of XPath, shall support a subset of the XPath language."

The spec provides the details about the subset, see here: http://docs.opengeospatial.org/is/09-026r2/09-026r2.html#37

That said, it does not mean that a server should limit its implementation to that subset. If you have development resources or funding to get more comprehensive XPath support built, see this guide: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.