0

I'm trying to construct WFS 1.1.0 requests by POST, which means sending an XML document. I'm having a lot of trouble working out the exact format of this document. Most of the documentation is geared around GET requests, passing parameters by URL.

Somewhat by trial and error I have worked out that for GetFeature, for instance:

  • propertyName is an element under <wfs:query> (as <wfs:propertyName>)
  • typeNameis an attribute of <wfs:query>
  • maxFeatures is an attribute of the top level <wfs:GetFeature> element

But I have no idea where to put BBOX, for instance.

Is there a clear source of documentation for the POST format?

2

As always with OGC standards you can download and read the standard for free. For WFS 1.1.0 goto http://www.opengeospatial.org/standards/wfs and download the PDF. On pages 33 and 34 you will see the XML schema fragment that describes exactly the required format of a WFS request.

<xsd:element name="GetFeature" type="wfs:GetFeatureType"/>
<xsd:complexType name="GetFeatureType">
  <xsd:complexContent>
    <xsd:extension base="wfs:BaseRequestType">
      <xsd:sequence>
        <xsd:element ref="wfs:Query" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="resultType" type="wfs:ResultTypeType" use="optional" default="results"/>
      <xsd:attribute name="outputFormat" type="xsd:string" use="optional" default="text/xml;                                                  subtype=3.1.1"/>
      <xsd:attribute name="maxFeatures" type="xsd:positiveInteger" use="optional"/>
      <xsd:attribute name="traverseXlinkDepth" type="xsd:string" use="optional"/>
      <xsd:attribute name="traverseXlinkExpiry" type="xsd:positiveInteger" use="optional"/>
    </xsd:extension>
  </xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="ResultTypeType">
  <xsd:restriction base="xsd:string">
    <xsd:enumeration value="results"/>
    <xsd:enumeration value="hits"/>
  </xsd:restriction>
</xsd:simpleType>
<xsd:element name="Query" type="wfs:QueryType"/>
<xsd:complexType name="QueryType">
  <xsd:sequence>
    <xsd:choice minOccurs="0" maxOccurs="unbounded">
      <xsd:element ref="wfs:PropertyName"/>
      <xsd:element ref="ogc:Function"/>
    </xsd:choice>
    <xsd:element ref="ogc:Filter" minOccurs="0" maxOccurs="1"/>
    <xsd:element ref="ogc:SortBy" minOccurs="0" maxOccurs="1"/>
  </xsd:sequence>
  <xsd:attribute name="handle" type="xsd:string" use="optional"/>
  <xsd:attribute name="typeName" type="wfs:TypeNameListType" use="required"/>
  <xsd:attribute name="featureVersion" type="xsd:string" use="optional"/>
  <xsd:attribute name="srsName" type="xsd:anyURI" use="optional"/>
</xsd:complexType>
<xsd:simpleType name="Base_TypeNameListType">
  <xsd:list itemType="QName"/>
</xsd:simpleType>
<xsd:simpleType name="TypeNameListType">
  <xsd:restriction base="wfs:Base_TypeNameListType">
    <xsd:pattern value="((\w:)?\w(=\w)?){1,}"/>
  </xsd:restriction>
</xsd:simpleType>
  • Yes, I did come across that, but XSL is pretty hard to read. It also doesn't refer to BBOX at all. Can I infer from that there is no shorthand way to apply a BBOX without having to construct the whole Filter structure? (Whereas BBOX is a top level parameter in the URL) – Steve Bennett Jun 13 '18 at 12:11
  • that is the case, you need a BBOX filter – Ian Turton Jun 13 '18 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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