【问题标题】:Invalid typenames in WFS:GetFeatures POST?WFS:GetFeatures POST 中的类型名称无效?
【发布时间】:2017-11-06 17:23:44
【问题描述】:

我正在尝试让最简单的 WFS HTTP_POST 请求针对 GeoServer WFS 端点工作。

此 HTTP_GET 请求有效,并返回我所期望的(为清楚起见插入了换行符):

http://mygeoserver.com/geoserver/ows?
    service=wfs&
    version=2.0.0&
    request=getfeature&
    count=3&
    typenames=mynamespace:myfeaturetype&
    cql_filter=dccode=%27XYZ%27

我希望这个 HTTP_POST 请求:

http://mygeoserver.com/geoserver/ows

使用此请求正文:

<GetFeature
    version="2.0.0"
    service="WFS"
    count="3"
    xmlns="http://www.opengis.net/wfs/2.0"
    xmlns:fes="http://www.opengis.net/fes/2.0"
    xmlns:gsml="http://xmlns.geosciml.org/GeoSciML-Core/3.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0
    http://schemas.opengis.net/wfs/2.0/wfs.xsd"
    >

    <Query
        typeNames="mynamespace:myfeaturetype"
        >
        <Filter  
            xmlns="http://www.opengis.net/fes/2.0" 
            xmlns:xlink="http://www.w3.org/1999/xlink" 
            xmlns:gsml="http://xmlns.geosciml.org/GeoSciML-Core/3.2" >
            <PropertyIsEqualTo>
                <ValueReference>dccode</ValueReference>
                <Literal>XYZ</Literal>
            </PropertyIsEqualTo>
        </Filter>
    </Query>
</GetFeature>

返回相同的。

我得到一个错误:

    cvc-datatype-valid.1.2.3: 'mynamespace:myfeaturetype' is not a valid value of union type 'TypeNamesType'.

    cvc-attribute.3: The value 'mynamespace:myfeaturetype' of attribute 'typeNames' on element 'Query' is not valid with respect to its type, 'TypeNamesListType'.

让我陷入循环的是,适用于 HTTP_GET 中 typeNames 参数的相同值会在 HTTP_POST 中引发错误。

问题似乎是我需要在 XML 中为“mynamespace”指定一个命名空间定义。

<Query
    typeNames="mynamespace:myfeaturetype"
    xmlns:mynamespace="http://????"
    >

我假设这是可用的,在我的 GeoServer 安装中的某个地方。但是在哪里?

【问题讨论】:

    标签: gis gdal geoserver wms ogc


    【解决方案1】:

    它将是您设置为工作区 mynamespace 的 URI 的任何内容。您可以使用 describeFeature 请求查看它。比如:

    curl http://localhost:8080/geoserver/wfs\?service=wfs\&version=1.1.0\&request=DescribeFeatureType\&typeName=topp:states
    

    给予:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:gml="http://www.opengis.net/gml" 
       xmlns:topp="http://www.openplans.org/topp" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
       elementFormDefault="qualified" 
       targetNamespace="http://www.openplans.org/topp">
      <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/3.1.1/base/gml.xsd"/>
      <xsd:complexType name="statesType">
        <xsd:complexContent>
         [....]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多