-
Notifications
You must be signed in to change notification settings - Fork 8
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
Possible workflow for viewing GML files with QGIS #3
Comments
I added this issue because I only recently became aware of the possibility of this way of viewing GML files (as opposed to seeing only few attributes, or having to use the GML application schema toolbox plugin). Ideas for tests for GML:
|
These are three of the ideas that we (OS) came up with (in 2015) as 'things we would like to see' in desktop GIS clients viewing GML, after the OGC UK Interoperability Plugfest. See https://www.ordnancesurvey.co.uk/about/governance/policies/gml-design.html and https://portal.opengeospatial.org/files/?artifact_id=61057 |
We opened an issue in the QGIS issue tracker proposing a feature for including the GML_ATTRIBUTES_TO_OGR_FIELDS=YES as default behaviour for GML loading. |
I don't see the other ogr/gdal driver for GML ('https://gdal.org/drivers/vector/gmlas.html#vector-gmlas') mentionned. That's surprising as there was an important EU investment (EEA, BRGM, others) both on the driver and the capacity for QGIS plugins to use it (see https://plugins.qgis.org/plugins/gml_application_schema_toolbox/). |
The QGIS plugin + associated OGR/GDAL driver are considered. Please take a look at the results from the tests with data discovered through the INSPIRE Geoportal. You would notice that for many of the tests in the case of QGIS 3.x the functionality is considered as supported because of the QGIS plugin + ogr/gdal driver. |
My bad. Indeed it's written 'Notes: need to use the 'GML Application Schema Toolbox' plugin' when clicking on some '3.4.4-Madeira' cells. Thanks Alex I'm reasured then :) |
I noticed that it actually is possible to have a setting in QGIS that makes the GML driver read XML attributes by default: GML_ATTRIBUTES_TO_OGR_FIELDS is both an open option as well as a configuration option. Configuration options can be set as environment variables, and environment variables can be set in QGIS: https://docs.qgis.org/testing/en/docs/user_manual/introduction/qgis_configuration.html#system-settings This means that the workflow becomes as simple as this once the above configuration is applied:
|
Thanks @heidivanparys. Interesting way forward which would likely require a minimal modification. @timlinux do you think it is feasible from a QGIS point of view to overwrite the default behavior of QGIS for the GML_ATTRIBUTES through the System settings instead of hard-coding the GML_ATTRIBUTES_TO_OGR_FIELDS=YES in order to change the default behavior of QGIS with INSPIRE GML?
|
Setting that option via the UI of QGIS has been fixed, see qgis/QGIS#28644 (comment) so GML_ATTRIBUTES_TO_OGR_FIELDS can be set on a dataset per dataset basis from within QGIS. |
Prerequisites
QGIS is installed (includes OSGeo4W).
Workflow
cd C:\path\to\folder
ogrinfo -al -oo GML_ATTRIBUTES_TO_OGR_FIELDS=YES gml_file_name.gml
Notes
.gfs files
Example:
Note: When editing the GML file again, the corresponding .gfs file must be resaved so it has a later timestamp than the GML file, else it will not be taken into account.
It is possible to specify the location of the .gfs file to use via a registry for GML application schemas, but you need administrator rights on your computer to edit gml_registry.xml (it is possible to point to a custom registry file, but QGIS does not support yet setting options for OGR, see below).
ogrinfo
The ogrinfo command is documented on https://www.gdal.org/ogrinfo.html
ogrinfo will recognize the file as a GML file and will therefore use the GML driver to open it, documented on https://www.gdal.org/drv_gml.html
A "configuration option", see also https://trac.osgeo.org/gdal/wiki/ConfigOptions, can be set by using the following syntax (thus without equal sign):
ogrinfo --config CONFIG_OPTION_NAME CONFIG_OPTION_VALUE
A "open option", also called "dataset open option", which is format specific, is set by using the following syntax (thus with equal sign):
ogrinfo --oo OPEN_OPTION_NAME=OPEN_OPTION_VALUE
Certain functionalities in OGR are available both as a configuration option and as an open option, sometimes with a different name for the option, so double-check the documentation.
QGIS does not yet support setting these options via the UI (see https://issues.qgis.org/issues/20825), therefore ogrinfo must be run with the OSGeo4W Shell application, and the layer added with QGIS afterwards.
When open option GML_ATTRIBUTES_TO_OGR_FIELDS is set YES, attributes of GML elements are also taken into account (e.g.
xlink:href
). Note that this currently does not work for thenilReason
attribute: OSGeo/gdal#1154The text was updated successfully, but these errors were encountered: