Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognization of FeatureCollections in deegree #1752

Open
dstenger opened this issue Oct 23, 2024 · 1 comment · May be fixed by #1758
Open

Recognization of FeatureCollections in deegree #1752

dstenger opened this issue Oct 23, 2024 · 1 comment · May be fixed by #1758
Labels
core deegree core modules needs discussion requires discussion with contributor TMC discussion to be discussed by technical management committee members

Comments

@dstenger
Copy link
Contributor

dstenger commented Oct 23, 2024

Background

deegree GML tools CLI is used to generate configuration from an INSPIRE schema. However, the generated configuration is empty. We analyzed this and the result was that some FeatureTypes are recognized as FeatureCollections. There is no configuration written for FeatureCollections.
The problem occurred with INSPIRE schema Geophysics and FeatureTypes ge_gp:GeophProfile and ge_gp:Campaign.

What does the GML specification say?

The specification says: "A GML feature collection is any GML feature with a property element in its content model whose content model is derived by extension from gml:AbstractFeatureMemberType (see 9.9.2)"

How does deegree behave?

FeatureTypes are considered as FeatureCollection in method ​isGML32FeatureCollection() if they have a property which is either derived from "AbstractFeatureMemberType" or "FeaturePropertyType".
There is also following comment in the code:

// handle deprecated FeatureCollection types as well (their properties are not
// based on
// AbstractFeatureMemberType, but on FeaturePropertyType)

How is this use case (INSPIRE) handled by deegree?

The INSPIRE schema has properties which are derived from "gml:FeaturePropertyType" and, thus, those FeatureTypes are considered as FeatureCollections by deegree.
In this case, the property "sam:sampledFeature" defined by https://schemas.opengis.net/sampling/2.0/samplingFeature.xsd causes the problem as it is of type "gml:FeaturePropertyType":

...
<element name="sampledFeature" type="gml:FeaturePropertyType" maxOccurs="unbounded" nillable="true" block="#all">
...

Why is deegree behaving like this?

The "AbstractFeatureCollectionType" is defined in ​https://schemas.opengis.net/gml/3.2.1/deprecatedTypes.xsd and includes a sequence of elements of type "FeaturePropertyType" (element featureMember):

...
<element name="featureMember" type="gml:FeaturePropertyType">
  <annotation>
    <appinfo>deprecated</appinfo>
  </annotation>
</element>
...
<complexType name="AbstractFeatureCollectionType" abstract="true">
  <annotation>
    <appinfo>deprecated</appinfo>
  </annotation>
  <complexContent>
    <extension base="gml:AbstractFeatureType">
      <sequence>
        <element ref="gml:featureMember" minOccurs="0" maxOccurs="unbounded"/>
        <element ref="gml:featureMembers" minOccurs="0"/>
      </sequence>
    </extension>
  </complexContent>
</complexType>
<element name="AbstractFeatureCollection" type="gml:AbstractFeatureCollectionType" abstract="true" substitutionGroup="gml:AbstractFeature">
...

So, the deprecatedTypes schema gives a hint why deegree behaves like this.

What are possible solutions?

  • Update method isGML32FeatureCollection(): Recognization of FeatureCollections basing on FeaturePropertyType for all types marked with 'deprecated'.
  • Update method isGML32FeatureCollection(): Recognization of FeatureCollections basing on FeaturePropertyType only for types in GML namespace.
  • Update method isGML32FeatureCollection(): Recognization of FeatureCollections basing on FeaturePropertyType not for types in INSPIRE namespace.
  • Allow FeatureCollections when writing SQLFeatureStore configuration generally (configurable via parameter).
@dstenger dstenger added question user question TMC discussion to be discussed by technical management committee members labels Oct 23, 2024
@stephanr
Copy link
Member

At first glance, I can see that it will be difficult to implement a general solution in the core that comes without side effects.
And seeing the issue, I could assume that the insertion of data might also be affected (WFS-T and GMLLoader see [1]).
So, in theory, a possible solution may also include an extension point, where different type decisions can be inserted based on the used schema (URL).

References:

  • [1]
    boolean featureStreamFromFactory = false;
    {
    Iterator<FeatureStreamFactory> it = featureStreamFactories.iterator();
    while (it.hasNext()) {
    FeatureStreamFactory fac = it.next();
    if (fac.isApplicableToDocumentRoot(xmlStream.getName())) {
    featureStreamFromFactory = true;
    this.featureStream = fac.createStream(xmlStream, gmlStreamReader);
    }
    }
    }
    if (featureStreamFromFactory) {
    // loaded from external factory
    }
    else if (new QName(WFS_200_NS, "FeatureCollection").equals(xmlStream.getName())) {
    LOG.debug("Features embedded in wfs20:FeatureCollection");
    this.featureStream = new WfsFeatureInputStream(xmlStream, gmlStreamReader, WFS_20_MEMBER);
    }
    else if (new QName(WFS_NS, "FeatureCollection").equals(xmlStream.getName())) {
    LOG.debug("Features embedded in wfs:FeatureCollection");
    this.featureStream = new WfsFeatureInputStream(xmlStream, gmlStreamReader, GML_MEMBER, GML_MEMBERS);
    }

@tfr42 tfr42 added core deegree core modules needs discussion requires discussion with contributor and removed question user question labels Oct 30, 2024
lgoltz added a commit to lat-lon/deegree3 that referenced this issue Nov 5, 2024
…ze-deprecated-types to disable recognition of deprecated feature collections
lgoltz added a commit to lat-lon/deegree3 that referenced this issue Nov 6, 2024
lgoltz added a commit to lat-lon/deegree3 that referenced this issue Nov 6, 2024
…ize-deprecated-types to enable recognition of deprecated feature collections
lgoltz added a commit to lat-lon/deegree3 that referenced this issue Nov 6, 2024
lgoltz added a commit to lat-lon/deegree3 that referenced this issue Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core deegree core modules needs discussion requires discussion with contributor TMC discussion to be discussed by technical management committee members
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants