具有时间参数的WFS GetFeature查询未在Geoserver中过滤

san*_*san 3 wms geoserver web-feature-service

我正在尝试通过在geoserver中使用WFS GetFeature来按GML格式按日期过滤一些数据,但是该操作会忽略time参数,而仅返回包含所有数据的巨大GML文件。这是我正在使用的查询:

http://localhost:8082/geoserver/it.geosolutions/ows?service=WFS&version=1.2.0&request=GetFeature&typeName=it.geosolutions:tsige&time=2011-07-25T00:00:00.0Z/2011-07-25T23:59:59.999Z
Run Code Online (Sandbox Code Playgroud)

根据这个,时间参数应在WFS GetFeature操作的支持,所以我不知道什么是错。此外,我还有什么其他选择来按时间以XML或JSON格式或其他易于解析的格式过滤数据?

小智 5

并非所有供应商实现都支持所有参数,这是使用OGC服务的乐趣之一。还要注意,GeoServer实现了WFS 1.0.0、1.1.0和2.0.0(在上面的示例中不是1.2.0)

您可以使用OGC过滤器通过(相对冗长的)POST请求来完成所需的操作,这可能适用于GET,但我将其留给读者练习。

<wfs:GetFeature 
  xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:gml="http://www.opengis.net/gml"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:ows="http://www.opengis.net/ows"
  xmlns:wfs="http://www.opengis.net/wfs"
  xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
service="WFS" version="1.1.0" outputFormat="JSON">
  <wfs:Query typeName="it.geosolutions:tsige" srsName="EPSG:4326">
    <ogc:Filter>
      <ogc:And>
        <ogc:PropertyIsGreaterThanOrEqualTo>
          <ogc:PropertyName>your-time-variabe-here</ogc:PropertyName>
          <ogc:Function name="dateParse">
            <ogc:Literal>yyyy-MM-dd</ogc:Literal>
            <ogc:Literal>2011-07-25</ogc:Literal>
          </ogc:Function>
        </ogc:PropertyIsGreaterThanOrEqualTo>
        <ogc:PropertyIsLessThan>
          <ogc:PropertyName>your-time-variable-here</ogc:PropertyName>
          <ogc:Function name="dateParse">
            <ogc:Literal>yyyy-MM-dd</ogc:Literal>
            <ogc:Literal>2011-07-26</ogc:Literal>
          </ogc:Function>
        </ogc:PropertyIsLessThan>
      </ogc:And>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>
Run Code Online (Sandbox Code Playgroud)

您可以使用curl将测试保存为 wfs.xml

curl -d @wfs.xml -H "Content-Type: application/xml" "http://localhost:8082/geoserver/it.geosolutions/ows"
Run Code Online (Sandbox Code Playgroud)