Features - GML

specstableimplcandidate

Encode features as GML.

Scope

For a WFS feature provider, the features are accessed as GML from the WFS and rewritten to the response. In case of Features the root element is sf:FeatureCollection.

For a SQL feature provider, the features are mapped to GML object and property elements based on the provider schema. A number of configuration options exist to control how the features are mapped to XML.

All configuration options of this building block except gmlSfLevel are only applicable for collections with a SQL feature provider. For collections with a WFS feature provider, all other configuration options are ignored.

The following descriptions all apply only to collections with a SQL feature provider:

  • The feature property with the role ID in the provider schema is mapped to the gml:id
    attribute of the feature. These properties must be a direct property of the feature type.
  • Geometry properties will be mapped to the corresponding GML 3.2 geometry (gml:Point and
    gml:MultiPoint with gml:pos; gml:LineString, gml:MultiCurve, gml:Polygon, and
    gml:MultiSurface with gml:posList). No gml:id attribute is added to geometry
    elements. The srsName attribute is set in each geometry.
  • Properties that are OBJECTs with object type Link will be mapped to a gml:Reference
    value with xlink:href and xmlnk:title attributes, if set.
  • Properties that are OBJECTs with object type Measure will be mapped to a
    gml:MeasureType value. The object must have the properties value and uom, which
    both must be present in the data.
  • Properties that are FLOAT or INTEGER values with a unit property in the provider
    schema are mapped to a gml:MeasureType value, too. The value of unit is mapped to the
    uom attribute.

Conformance Classes

In general, Features GML implements all requirements of conformance class Geography Markup Language (GML), Simple Features Profile, Level 0 and Geography Markup Language (GML), Simple Features Profile, Level 2 from OGC API - Features - Part 1: Core 1.0open in new window. However, conformance depends on the conformance of the GML application schema with the GML Simple Features standard. Since the GML application schema is not controlled by ldproxy, the conformance level needs to be declared as part of the configuration.

For SQL feature providers a different root element than sf:FeatureCollection can be configured for the Features resource. In that case, the API cannot conform to any of the GML conformance classes of OGC API Features.

Configuration

By default, every GML property element will receive the property name from the feature schema. That is, the element will be in the default namespace. A different name can be set using the rename transformation, which can be used to change the name, but also supports to add a namespace prefix.

Options

NameDefaultDescriptionTypeSince
buildingBlock
Always GML.
string
v2.0
enabled
false
Enable the building block?
boolean
v2.0
transformations
{}
Property transformations do not affect data sources, they are applied on-the-fly as part of the encoding. Filter expressions do not take transformations into account, they have to be based on the source values. That means queryable properties (see queryables in Features) should not use transformations in most cases. The exception to the rule is the HTML encoding, where readability might be more important than filter support.
object
v2.0
defaultProfiles
{}
Allows to change the default value of the profile parameter for a specific format. The key is the kind of profile, e.g. rel or val. The value is the default profile value, e.g. rel-as-uri or val-as-title. If only some or no profile kinds are set, the application defaults apply.
object
v4.2
gmlVersion
GML32
Selects the GML version to use: GML32 for GML 3.2, GML31 for GML 3.1 and GML21 for GML 2.1.
string
v3.3
gmlSfLevel
null
The default null declares that the GML support does not meet all requirements of the Geography Markup Language (GML), Simple Features Profile, Level 0 or the Geography Markup Language (GML), Simple Features Profile, Level 2 conformance classes from OGC API - Features - Part 1: Core 1.0open in new window. If the value is set to 0, 1 or 2, the conformance will be declared in the Conformance Declaration resource. If for a collection from a SQL feature provider a root element different to sf:FeatureCollection is configured in featureCollectionElementName, the value will be ignored and no conformance to a GML conformance class will be declared.
number
v3.3
conformance
string
v2.0
applicationNamespaces
{}
Every XML element will have and XML attribute can have an XML namespace. To improve readability of the XML documents, a namespace prefix is declared for every namespace. Common namespaces and prefixes are pre-defined, these are: gml (GML 3.2), xlink (XLink), xml (XML), sf (OGC API Features Core 1.0, Core-SF), wfs (WFS 2.0), and xsi (XML Schema Information). Additional namespaces that are used in the data (declared in GML application schemas and imported schemas), the namespaces are configured with their prefixes. Since feature data will always use elements in application-schema-specific namespaces, this confirguration parameter will always need to be specified.
object
v3.3
defaultNamespace
null
A default namespace that is used for XML elements, if no other namespace is specified, can be specified with this configuration parameter. The value will be the namespace prefix. It must be either a pre-defined prefix or a prefix declared in applicationNamespaces. This namespace will be declared as the default namespace of the XML document.
string
v3.3
schemaLocations
null
If any application namespace should be included in the xsi:schemaLocation attribute of the root element, the document URIs have to be provided. In addition, the schema location of the namespace of the root element will be added, if known. For the pre-defined namespaces (gml, sf and wfs), the canonical schema location in the OGC schema repository will be used unless another schema location for the namespace is configured. Note that to meet XML Schema validation requirements, the namespace of the root element must be declared in the xsi:schemaLocation attribute, even if the namespace is imported by another schema.
object
v3.3
objectTypeNamespaces
{}
All object/data type instances are represented through a GML object element. In the provider schema, a name must be provided for each OBJECT in the objectType property, including for the feature type itself. By default, this name will be used for the unqualified name of the GML object element. If the GML object element is not in the default namespace, this configuration parameter assigns a namespace prefix to an object type.
object
v3.3
variableObjectElementNames
{}
There may also be cases, in particular when inheritance is used in the underlying application schema, where multiple object types are represented in the same table with an attribute that specifies the name of the feature/object type. This configuration parameter provides the capability to identify these properties and map the values to qualified names for the GML object element. In the example, _type is the feature property with three different values mapped to the qualified element name.
object
v3.3
featureCollectionElementName
sf:FeatureCollection
Various feature collection elements are in use and sometimes additional ones are specified in GML application schemas. The default is sf:FeatureCollection as specified by OGC API Features. This configuration parameter provides a capability to use a different feature collection element.
string
v3.3
featureMemberElementName
sf:featureMember
The feature collection element referenced in featureCollectionElementName has a child property element that contains each feature. The default is sf:featureMember as specified by OGC API Features. This configuration parameter provides a capability to declare the element name for the feature collection element.
string
v3.3
supportsStandardResponseParameters
false
The feature collection element referenced in featureCollectionElementName may support the WFS 2.0 standard response parameters (timeStamp, numberMatched, numberReturned). This configuration parameter controls whether the attributes are included in the feature collection element as XML attributes.
boolean
v3.3
xmlAttributes
[]
Properties are by default represented as the XML child element (GML property element) of the XML element representing the object (GML object element). Alternatively, the property can be represented as an XML attribute of the parent GML object element. This is only possible for properties of type STRING, FLOAT, INTEGER, or BOOLEAN.
array
v3.3
gmlIdPrefix
null
The feature property with role ID in the provider schema is mapped to the gml:id attribute of the feature. These properties must be a direct property of the feature type. If the values violate the rule for XML IDs, e.g., if they can start with a digit, this configuration parameter can be used to add a consistent prefix to map all values to valid XML IDs.
string
v3.3
gmlIdOnGeometries
false
This option adds a gml:id attribute on all GML geometry elements. The id attribute was required by GML 3.2 until 2016, older copies of the GML schema may still require the attribute. This option allows to create instances that are valid for such schemas.
boolean
v4.0

Examples


- buildingBlock: GML
  enabled: true
  applicationNamespaces:
    ns1: http://www.example.com/ns/ns1/1.0
    ns2: http://www.example.com/ns/ns2/1.0
  defaultNamespace: ns1
  schemaLocations:
    ns1: '{{serviceUrl}}/resources/ns1.xsd'
    ns2: '{{serviceUrl}}/resources/ns2.xsd'
  gmlIdPrefix: '_'
collections:
  some_type:
    ...
    api:
    - buildingBlock: GML
      xmlAttributes:
        - someAtt
      transformations:
        someOtherAtt:
          rename: 'ns2:someOtherAtt'