Please check Geoserver User Thread to see if a solution has been identified: http://osgeo-org.1560.x6.nabble.com/WFS-Temporal-Filter-with-TimePeriod-td5374460.html
The Goeserver GetCapabilities states that the two operand options are gml:TimeInstant and gml:TimePeriod, but I can only get TimeInstant to work. TimePeriod does not seem to work.
Example of gml:TimePeriod that doesn’t work ( I also tried different operators and one level up on the xpath ValueReference, but it seems the issue is Geoserver parsing the TimePeriod itself)
<GetFeature xmlns="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:private="http://www.private.com/private/1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:om="http://www.opengis.net/om/2.0"
xmlns:sf="http://www.opengis.net/sampling/2.0"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.0.0"
service="WFS"
handle="Example Query"
xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd">
<Query typeNames="private:FeatureName" handle="Query">
<fes:Filter>
<fes:EndedBy> <fes:ValueReference>private:FeatureName/om:OM_Observation/om:phenomenonTime/gml:TimePeriod</fes:ValueReference>
<gml:TimePeriod gml:id="id1" >
<gml:beginPosition>2017-07-14T20:00:00Z</gml:beginPosition>
<gml:endPosition>2017-07-14T21:00:00Z</gml:endPosition>
</gml:TimePeriod>
</fes:EndedBy>
</fes:Filter>
</Query>
</GetFeature>
Error back from Geoserver with gml:TimePeriod
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExceptionReport xmlns="http://www.opengis.net/ows/1.1">
<Exception exceptionCode="500">
<ExceptionText>[Request parsing failed
Parsing failed for TimePeriod: java.lang.ClassCastException: org.geotools.temporal.object.DefaultPosition cannot be cast to org.opengis.temporal.Instant
org.geotools.temporal.object.DefaultPosition cannot be cast to org.opengis.temporal.Instant]:[Ljava.lang.StackTraceElement;@78093ec5</ExceptionText>
</Exception>
</ExceptionReport>
For reference, here is the query portion of a request using gml:TimeInstant that works:
<Query typeNames="private:FeatureName" handle="Query">
<fes:Filter>
<fes:TEquals>
<fes:ValueReference>private:FeatureName/om:OM_Observation/om:phenomenonTime/gml:TimePeriod/gml:beginPosition</fes:ValueReference>
<gml:TimeInstant gml:id="id2"><gml:timePosition>2018-08-14T16:00:00Z</gml:timePosition></gml:TimeInstant>
</fes:TEquals>
</fes:Filter>
</Query>
I tried checking for examples in the unit tests, but from what I found it looks like they neither use a TimeInstant or a TimePeriod which doesn’t really jive with what the Geoserver GetCapabilities states. The examples also seem to only show the equivalent of a TimeInstant filtering on a single time.
|