BRGM / gml_application_schema_toolbox

GML Application Schema toolbox is a QGIS plugin allowing to manipulate OGC Complex Features
https://brgm.github.io/gml_application_schema_toolbox/
GNU General Public License v2.0
28 stars 18 forks source link

Can GDAL GMLAS handle local reference xlink:href="# #31

Closed sgrellet closed 6 years ago

sgrellet commented 7 years ago

Importing one of the 3 URIs below http://ressource.brgm-rec.fr/data/EntiteHydroGeol/113AI01 http://ressource.brgm-rec.fr/data/EntiteHydroGeol/121AU http://ressource.brgm-rec.fr/data/EntiteHydroGeol/121AT30

GDAL GMLAS identifies properly the various information elements. However the GUI is not able from the 'identify' action on the mappedfeature the link to the other tables. Is the driver capable of handling the <gsmlb:specification xlink:href="# structure (ex : in the last URI ) ?

rouault commented 7 years ago

Regarding http://ressource.brgm-rec.fr/data/EntiteHydroGeol/121AT30

$ ogrinfo GMLAS:test.xml -oo remove_unused_layers=yes mappedfeature 

OGRFeature(mappedfeature):1
  id (String) = MappedFeature.234
[...]
  specification_href (String) = #EntiteHydroGeol.121AT30
[...]

So the GMLAS driver only recognizes the specification link as a generic string.

The reason is that the gsmlb:specification element is defined as such

                                        <element name="specification" type="gml:FeaturePropertyType" minOccurs="0">
                                                <annotation>
                                                        <documentation>The specification association links an instance of MappedFeature to the GFI_Feature being mapped. In a geological map, MappedFeatures are used to represent GeologicFeatures, but other features from other domains could be represented.</documentation>
                                                        <appinfo>
                                                                <targetElement xmlns="http://www.opengis.net/gml/3.2">null:GFI_Feature</targetElement>
                                                        </appinfo>
                                                </annotation>
                                        </element>

So there's no direct connection with a gwml2:GW_Aquifer element. To be able to do that connection, that would require adding an initial pass to the driver that would create a map from gml:id to their belonging element, and a map from xlink:href values to their belonging elements, so that you finally you can establish existing relationships between both and feed that into the schema analyzer

sgrellet commented 7 years ago

Supporting this xlink:href="# pattern is a must have to me as it is often used. Do you see a way to 'patch' this on the client side before having this implemented in the GMLAS driver ?

sgrellet commented 7 years ago

examples added in https://github.com/BRGM/gml_application_schema_toolbox/tree/master/samples/href%23

rouault commented 6 years ago

Implemented in GDAL trunk r40973

$ ogrinfo GMLAS:GWML2.xml  -oo remove_unused_layers=yes -oo remove_unused_fields=yes -oo expose_metadata_layers=yes -al | less
[...]
OGRFeature(mappedfeature):1
  id (String) = MappedFeature.234
  resolutionrepresentativefraction (Integer) = 50000
  mappingframe_href (String) = http://resource.geosciml.org/feature/brgm/EarthBedrockSurface
  specification_href (String) = #EntiteHydroGeol.121AT30
  specification_abstractfeature_gw_aquifer_pkid (String) = EntiteHydroGeol.121AT30
[...]
OGRFeature(_ogr_fields_metadata):2592
  layer_name (String) = mappedfeature
  field_index (Integer) = 53
  field_name (String) = specification_abstractfeature_gw_aquifer_pkid
  field_xpath (String) = gsml:MappedFeature/gsml:specification/gwml2:GW_Aquifer
  field_type (String) = string
  field_is_list (Integer(Boolean)) = 0
  field_min_occurs (Integer) = 0
  field_max_occurs (Integer) = 1
  field_category (String) = PATH_TO_CHILD_ELEMENT_WITH_LINK
  field_related_layer (String) = gw_aquifer
[...]
OGRFeature(_ogr_layer_relationships):853
  parent_layer (String) = mappedfeature
  parent_pkid (String) = id
  parent_element_name (String) = specification_abstractfeature_gw_aquifer_pkid
  child_layer (String) = gw_aquifer
  child_pkid (String) = id
[...]
sgrellet commented 6 years ago

I'll test it when pushed to gdal-dev in OsGeo4W. Currently I have access to gdal-dev 2.3.0-40977