Skip to content

Commit

Permalink
Hide the erroneous output formats for FME from GetCapabilities
Browse files Browse the repository at this point in the history
This output format doesn't have to be advertised.
It only needs to be accepted as valid option.
  • Loading branch information
vdboor committed Dec 11, 2024
1 parent 4d3e28c commit 7eaad50
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions docs/compliance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ To support these clients, the following logic is also implemented:
* The ``TYPENAME`` parameter instead of ``TYPENAMES`` (used by the CITE test suite!).
* Using ``A`` and ``D`` as sort direction in ``SORTBY`` / ``<fes:SortBy>`` instead of ``ASC`` and ``DESC``.

The FME (Feature Manipulation Engine) software sent ``OUTPUTFORMAT=application/gml+xml; version=3.2``
to all methods, including ``GetCapabilities`` and ``DescribeFeatureType``. These are also silently accepted.

For CITE test suite compliance, ``urn:ogc:def:query:OGC-WFS::GetFeatureById`` query returns an HTTP 404
for an invalid resource ID format, even though the WFS 2 specification states it should return
an ``InvalidParameterValue``. Likewise, the ``<ResourceId>`` query returns an empty list instead
Expand Down
3 changes: 3 additions & 0 deletions gisserver/operations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def __init__(
renderer_class=None,
max_page_size=None,
title=None,
in_capabilities=True,
**extra,
):
"""
Expand All @@ -142,6 +143,7 @@ def __init__(
If it's not given, the operation renders it's output using an XML template.
:param max_page_size: Used to override the ``max_page_size`` of the renderer_class.
:param title: A human-friendly name for an HTML overview page.
:param in_capabilities: Whether this format needs to be advertised in GetCapabilities.
:param extra: Any additional key-value pairs for the definition.
Could include ``subtype`` as a shorter alias for the MIME-type.
"""
Expand All @@ -150,6 +152,7 @@ def __init__(
self.subtype = self.extra.get("subtype")
self.renderer_class = renderer_class
self.title = title
self.in_capabilities = in_capabilities
self._max_page_size = max_page_size

def matches(self, value):
Expand Down
15 changes: 11 additions & 4 deletions gisserver/operations/wfs20.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ class GetCapabilities(WFSMethod):
"""This operation returns map features, and available operations this WFS server supports."""

output_formats = [
OutputFormat("application/gml+xml", version="3.2", title="GML"), # for FME
OutputFormat("text/xml"),
OutputFormat(
# for FME (Feature Manipulation Engine)
"application/gml+xml",
version="3.2",
title="GML",
in_capabilities=False,
),
]
xml_template_name = "get_capabilities.xml"

Expand Down Expand Up @@ -143,13 +149,14 @@ class DescribeFeatureType(WFSTypeNamesMethod):

output_formats = [
OutputFormat("XMLSCHEMA", renderer_class=output.XMLSchemaRenderer),
# At least one version of FME seems to sends a DescribeFeatureType
# request with this output format. Do what mapserver does and just
# send it XML Schema.
# At least one version of FME (Feature Manipulation Engine) seems to
# send a DescribeFeatureType request with this GML as output format.
# Do what mapserver does and just send it XML Schema.
OutputFormat(
"application/gml+xml",
version="3.2",
renderer_class=output.XMLSchemaRenderer,
in_capabilities=False,
),
# OutputFormat("text/xml", subtype="gml/3.1.1"),
]
Expand Down
4 changes: 2 additions & 2 deletions gisserver/templates/gisserver/wfs/2.0.0/get_capabilities.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
</ows:Keywords>{% endif %}
<DefaultCRS>{{ feature_type.crs }}</DefaultCRS>{% for crs in feature_type.other_crs %}
<OtherCRS>{{ crs }}</OtherCRS>{% endfor %}
<OutputFormats>{% for output in feature_output_formats %}
<Format>{{ output }}</Format>{% endfor %}
<OutputFormats>{% for output in feature_output_formats %}{% if output.in_capabilities %}
<Format>{{ output }}</Format>{% endif %}{% endfor %}
</OutputFormats>
{% if BOUNDING_BOX %}{% with bbox=feature_type.get_bounding_box %}{% if bbox %}<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>{{ bbox.lower_corner|join:" " }}</ows:LowerCorner>
Expand Down

0 comments on commit 7eaad50

Please sign in to comment.