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

QGIS ignores field inherited from parent feature type in WFS 2.0 services #42660

Closed
denevers opened this issue Apr 5, 2021 · 2 comments
Closed
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! WFS data provider

Comments

@denevers
Copy link

denevers commented Apr 5, 2021

When loading data from a WFS 2.0 service, the list of fields is missing gml:name and gml:description. It looks like it only considers the fields explicitly provided in the DescribeFeatureType but does not include the field from the parent feature type.

eg: British Columbia Geological Survey WFS

http://apps.empr.gov.bc.ca/geoserver/cgi/ows?SERVICE=WFS

  1. Go to Layer/Add WFS Layer
  2. Click [New] and use this URL : http://apps.empr.gov.bc.ca/geoserver/cgi/ows
  3. You might want to set a Max. number of feature (100), it's a large dataset
  4. When done, clikc [Connect] and pick CA-BC BCGS 1:150k bedrock geology layer
  5. click [add] and close the dialog
  6. right click on layer and pick "properties", then lock a "Fields". 3fields are missing : identifier, name and description

Compare to XML output

http://apps.empr.gov.bc.ca/geoserver/cgi/ows?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&typeNames=cgi:CA-BC-BCGS-bedrock-geology_v01&count=1&outputFormat=text/xml; subtype=gml/3.2

(browser won't recognise as XML, so will be asked to save)

included below

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:cgi="http://142.34.2.145:8080/cgi"
    xmlns:wfs="http://www.opengis.net/wfs/2.0"
    xmlns:gml="http://www.opengis.net/gml/3.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberMatched="33409" numberReturned="1" timeStamp="2021-04-05T15:22:32.280Z" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://apps.empr.gov.bc.ca/geoserver/schemas/wfs/2.0/wfs.xsd http://142.34.2.145:8080/cgi http://apps.empr.gov.bc.ca/geoserver/cgi/wfs?service=WFS&amp;version=2.0.0&amp;request=DescribeFeatureType&amp;typeName=cgi%3ACA-BC-BCGS-bedrock-geology_v01 http://www.opengis.net/gml/3.2 http://apps.empr.gov.bc.ca/geoserver/schemas/gml/3.2.1/gml.xsd">
    <wfs:member>
        <cgi:CA-BC-BCGS-bedrock-geology_v01 gml:id="CA-BC-BCGS-bedrock-geology_v01.8837">
            <gml:description>Grey, biotite-hornblende quartz diorite to granodiorite, and brown to greenish plagioclase-phyric, hornblende-biotite quartz monzonite; fine- to medium-grained</gml:description>
            <gml:identifier codeSpace="http://142.34.2.145:8080/cgi">5e47bfe13c2bd94cb2cbb32538d98005</gml:identifier>
            <gml:name>Middle Jurassic Endako Batholith - Stag Lake Plutonic Suite - Stellako Phase</gml:name>
            <cgi:genericsymbolizer>MJSLSqd</cgi:genericsymbolizer>
            <cgi:geologicunittype>lithodemic_unit</cgi:geologicunittype>
            <cgi:rank>lithodeme</cgi:rank>
            <cgi:lithology>quartz diorite</cgi:lithology>
            <cgi:geologichistory>Middle Jurassic intrusive rocks: quartz dioritic intrusive rocks</cgi:geologichistory>
            <cgi:numericolderage>173.5</cgi:numericolderage>
            <cgi:numericyoungerage>161.3</cgi:numericyoungerage>
            <cgi:observationmethod>compilation</cgi:observationmethod>
            <cgi:positionalaccuracy>100 m</cgi:positionalaccuracy>
            <cgi:source>http://www.em.gov.bc.ca/Mining/Geoscience/PublicationsCatalogue/OpenFiles/2007/2007-10/Pages/default.aspx</cgi:source>
            <cgi:geologicunittype_uri>http://resource.geosciml.org/classifier/cgi/geologicunittype/lithodemic_unit</cgi:geologicunittype_uri>
            <cgi:representativelithology_uri>http://resource.geosciml.org/classifier/cgi/lithology/quartz_diorite</cgi:representativelithology_uri>
            <cgi:representativeage_uri>http://resource.geosciml.org/classifier/ics/ischart/MiddleJurassic</cgi:representativeage_uri>
            <cgi:representativeolderage_uri>http://resource.geosciml.org/classifier/ics/ischart/MiddleJurassic</cgi:representativeolderage_uri>
            <cgi:representativeyoungerage_uri>http://resource.geosciml.org/classifier/ics/ischart/MiddleJurassic</cgi:representativeyoungerage_uri>
            <cgi:eventprocess_uri>http://resource.geosciml.org/classifier/cgi/eventprocess/intrusion</cgi:eventprocess_uri>
            <cgi:eventenvironment_uri>http://resource.geosciml.org/classifier/cgi/eventenvironment/earth_interior_setting</cgi:eventenvironment_uri>
            <cgi:specification_uri>http://142.34.2.40/viewpoint/mpls2/report/bedrock250k_single_summary.asp?upid=3c2bd94c</cgi:specification_uri>
            <cgi:metadata_uri>https://catalogue.data.gov.bc.ca/dataset/bedrock-geology</cgi:metadata_uri>
            <cgi:shape>Polygon</cgi:shape>
            <cgi:color_id>155</cgi:color_id>
            <cgi:the_geom>
                <gml:Polygon srsName="urn:ogc:def:crs:EPSG::4326" srsDimension="2" gml:id="CA-BC-BCGS-bedrock-geology_v01.8837.the_geom">
                    <gml:exterior>
                        <gml:LinearRing>
                            <gml:posList>54.116937 -125.255623 54.118155 -125.253388 54.119184 -125.251653 54.120513 -125.249616 54.122247 -125.246445 54.123627 -125.243086 54.124762 -125.241042 54.126209 -125.238757 54.128256 -125.235095 54.127977 -125.233638 54.127347 -125.231881 54.125913 -125.226589 54.125264 -125.223526 54.124497 -125.221669 54.123411 -125.219721 54.121396 -125.215033 54.120508 -125.212801 54.119331 -125.210792 54.118298 -125.208166 54.116606 -125.203393 54.116021 -125.201579 54.115664 -125.199892 54.115424 -125.197937 54.115046 -125.196055 54.114472 -125.189039 54.113663 -125.190201 54.107915 -125.200051 54.105058 -125.205441 54.103457 -125.208224 54.103586 -125.208915 54.103701 -125.210749 54.104482 -125.214262 54.105089 -125.218022 54.105778 -125.221533 54.10655 -125.224811 54.107773 -125.231455 54.108557 -125.234678 54.112281 -125.24632 54.114208 -125.250557 54.116074 -125.25415 54.116937 -125.255623</gml:posList>
                        </gml:LinearRing>
                    </gml:exterior>
                </gml:Polygon>
            </cgi:the_geom>
        </cgi:CA-BC-BCGS-bedrock-geology_v01>
    </wfs:member>
</wfs:FeatureCollection>

Note

            <gml:description>Grey, biotite-hornblende quartz diorite to granodiorite, and brown to greenish plagioclase-phyric, hornblende-biotite quartz monzonite; fine- to medium-grained</gml:description>
            <gml:identifier codeSpace="http://142.34.2.145:8080/cgi">5e47bfe13c2bd94cb2cbb32538d98005</gml:identifier>
            <gml:name>Middle Jurassic Endako Batholith - Stag Lake Plutonic Suite - Stellako Phase</gml:name>

If we check WFS DescribeFeatureType which returns the schema

http://apps.empr.gov.bc.ca/geoserver/cgi/ows?SERVICE=WFS&REQUEST=DescribeFeatureType&VERSION=2.0.0&typeNames=cgi:CA-BC-BCGS-bedrock-geology_v01

this returns a XSD

<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:cgi="http://142.34.2.145:8080/cgi" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://142.34.2.145:8080/cgi">
  <xsd:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://apps.empr.gov.bc.ca/geoserver/schemas/gml/3.2.1/gml.xsd"/>
  <xsd:complexType name="CA-BC-BCGS-bedrock-geology_v01Type">
    <xsd:complexContent>
      <xsd:extension base="gml:AbstractFeatureType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="0" name="genericsymbolizer" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="geologicunittype" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="rank" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="lithology" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="geologichistory" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="numericolderage" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="numericyoungerage" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="observationmethod" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="positionalaccuracy" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="source" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="geologicunittype_uri" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="representativelithology_uri" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="representativeage_uri" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="representativeolderage_uri" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="representativeyoungerage_uri" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="eventprocess_uri" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="eventenvironment_uri" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="specification_uri" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="metadata_uri" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="shape" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="color_id" nillable="true" type="xsd:int"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="the_geom" nillable="true" type="gml:SurfacePropertyType"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:element name="CA-BC-BCGS-bedrock-geology_v01" substitutionGroup="gml:AbstractFeature" type="cgi:CA-BC-BCGS-bedrock-geology_v01Type"/>
</xsd:schema>

note

      <xsd:extension base="gml:AbstractFeatureType">

this comes from this schemas

 <xsd:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://apps.empr.gov.bc.ca/geoserver/schemas/gml/3.2.1/gml.xsd"/>

this http://apps.empr.gov.bc.ca/geoserver/schemas/gml/3.2.1/gml.xsd, by the cascade on imports will eventually get to

http://apps.empr.gov.bc.ca/geoserver/schemas/gml/3.2.1/feature.xsd
http://apps.empr.gov.bc.ca/geoserver/schemas/gml/3.2.1/gmlBase.xsd

just how those two files are eventually loaded is through a mind numbing maze.. the chain of imports eventually pulls them both.

AbstractFeatureType (defined in feature) is a subtype of `AbstractGMLType' (defined in gmlBase) and this is where name, description and identifier are defined.

and QGIS does not consider them..

QGIS version
3.18.1-Zürich
QGIS code revision
202f1bf
Compiled against Qt
5.11.2
Running against Qt
5.11.2
Compiled against GDAL/OGR
3.1.4
Running against GDAL/OGR
3.1.4
Compiled against GEOS
3.8.1-CAPI-1.13.3
Running against GEOS
3.8.1-CAPI-1.13.3
Compiled against SQLite
3.29.0
Running against SQLite
3.29.0
PostgreSQL Client Version
11.5
SpatiaLite Version
4.3.0
QWT Version
6.1.3
QScintilla2 Version
2.10.8
Compiled against PROJ
6.3.2
Running against PROJ
Rel. 6.3.2, May 1st, 2020
OS Version
Windows 10 (10.0)
Active python plugins
db_manager;
MetaSearch;
processing

@denevers denevers added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Apr 5, 2021
@denevers denevers changed the title WFS 2.0 ignores field inherited from parent feature type QGIS ignores field inherited from parent feature type in WFS 2.0 services Apr 5, 2021
@Pedro-Murteira
Copy link

Still valid on QGIS 3.22.4 and 3.24.0.

@jratike80
Copy link

I wonder if this has some connection with the "Override GML Attributes" configuration option in Geoserver https://docs.geoserver.org/main/en/user/services/wfs/webadmin.html setting

For each GML type, there is also an “Override GML Attributes” checkbox. Selecting this (checking the checkbox) will cause attributes to be redefined in the application schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! WFS data provider
Projects
None yet
Development

No branches or pull requests

5 participants