Borys - pytanie do Ciebie o zasadność tego ficzera…
Taka historyjka. Klientka pobrała POG w GML ze strony Rejestru Urbanistycznego i metodą drag&drop wczytała do QGIS. Po otwarciu tabeli atrybutów stwierdziła, że nie ma najważniejszych informacji (profil podstawowy i rozszerzony). Stwierdziła, że z Rejestrem Urbanistycznym jest coś nie tak, bo obcina atrybuty…
Oczywiście problemem jest spłaszczanie GML podczas wczytywania. Dotyczy pewnie każdego GML (wypisy z EGIB też).
Oczywiście można wczytać GML przez wtyczkę APP2, ale “normalsi” o tym nie wiedzą…
Myślę o tym, żeby dodać do core ostrzeżenie, że jak wczytujesz GML i QGIS ogarnia, że wycina część atrybutów, to żeby ostrzegł usera komunikatem: “Ej, Ziomek - wczytujesz GML, który ma złożoną strukturę atrybutów. Ja potrafię wczytać tylko płaską tabelę, więc część danych pozostanie niewidoczna. Jeśli chcesz zapoznać się z całością atrybutów, poszukaj specjalistycznego narzędzia do tego rodzaju plików”
2 polubienia
borys
27 Listopad 2026 09:17
2
Obawiam się, że QGIS może nie wiedzieć, co GDAL przeoczył, więc to tam należałoby zadziałać. Nie mam pod ręką żadnego POG, więc nie mogę sprawdzić, czy nie wystarczy ustawić QGIS-owi zmiennej środowiskowej:
GML_ATTRIBUTES_TO_OGR_FIELDS=YES
albo po prostu sprawdzić:
ogrinfo -oo GML_ATTRIBUTES_TO_OGR_FIELDS=YES -al plan.gml
Jeśli to wystarczy, to poszedłbym tą drogą. Zresztą temat nie jest nowy:
otwarty 01:26PM - 10 Apr 19 UTC
Data Provider
Feature Request
Author Name: **Alexander Kotsev** (Alexander Kotsev)
Original Redmine Issue: [21… 826](https://issues.qgis.org/issues/21826)
Redmine category:data_provider/ogr
---
We work in Europe for the Joint Research Centre (European Commission) as technical coordinator of the EU INSPIRE Directive implementation. Within the context of INSPIRE, an increasing number of datasets are made available by European Union Member States as GML [1]. Application schemas (*.xsd) for INSPIRE are available at [2]. Most, if not all of the GML instances that are made available use attributes of GML elements such as xlink:href pointing to a registry with persistent uri [3]. The default behaviour of QGIS ignores those attributes which is inherited from the default OGR/GDAL logic for creating a *.gfs on first load of a GML instance. As a consequence, a significant portion of the available attribute content is 'invisible' in QGIS.
The issue is described in [4], and the solution is already available there. In a nutshell, when first loading the GML, the open option 'GML_ATTRIBUTES_TO_OGR_FIELDS' should be set to 'YES'. This would allow the generation of a fully-blown *.gfs correctly showing all GML attributes in QGIS (which would make the life of a lot of European data providers a lot easier). Sample GML instances are attached.
Addressing this issue would be very much appreciated.
Marco Minghini and Alex Kotsev
[1] http://inspire-geoportal.ec.europa.eu/
[2] http://inspire.ec.europa.eu/schemas/
[3] http://inspire.ec.europa.eu/registry/
[4] https://github.com/INSPIRE-MIF/caniuse/issues/3
---
- [LandUseNL.gml](https://issues.qgis.org/attachments/download/14772/LandUseNL.gml) (Alexander Kotsev)
otwarty 03:28AM - 22 Apr 26 UTC
Data Provider
Bug
### What is the bug or the crash?
Per this [GIS StackExchange Q&A](https://gis.… stackexchange.com/q/500549/2856), QGIS doesn't seem to be passing the `GML_ATTRIBUTES_TO_OGR_FIELDS` open option (at all, correctly, or at the correct time?) when opening a GML dataset.
According to the GDAL [GML driver](https://gdal.org/en/stable/drivers/vector/gml.html#open-options) Open options documentation for `GML_ATTRIBUTES_TO_OGR_FIELDS`:
> Defaults to NO. Whether GML attributes should be reported as OGR fields. **Note that this option has only an effect the first time a GML file is opened (before the .gfs file is created)**, and if it has no valid associated .xsd.
For example, the attached test.gml should show the below 3 fields if opened with `GML_ATTRIBUTES_TO_OGR_FIELDS=YES`. The last two fields are derived from GML attributes:
[test.gml.zip](https://github.com/user-attachments/files/26952698/test.gml.zip)
```
$ grep field test.gml
<ogr:field1>1</ogr:field1>
<ogr:field2 xlink:title="Title" xlink:href="https://mockhttp.org/get"/>
$ ogrinfo -so -al -oo GML_ATTRIBUTES_TO_OGR_FIELDS=YES test.gml
Layer name: INPUT
Geometry: Point
Feature Count: 1
<snip...>
field1: Integer (0.0)
field2_title: String (5.0)
field2_href: String (24.0)
$ rm test.gfs # removing the gfs just to demonstrate
```
However QGIS will only show `field1` when opening test.gml with `GML_ATTRIBUTES_TO_OGR_FIELDS` set to `YES`:
<img width="992" height="634" alt="Image" src="https://github.com/user-attachments/assets/86566f48-598d-44c2-b759-2d00fc8022e8" />
<img width="781" height="363" alt="Image" src="https://github.com/user-attachments/assets/4255e39c-2e66-4b23-9af3-c086b85f0440" />
If I pre-generate the .gfs with ogrinfo or set an environment variable `GML_ATTRIBUTES_TO_OGR_FIELDS=YES` then QGIS will load the other two fields correctly.
```
$ rm test.gfs # incorrect .gfs generated when QGIS opened the gml
$ ls
test.gml
$ ogrinfo -so -al -oo GML_ATTRIBUTES_TO_OGR_FIELDS=YES test.gml
...
$ ls
test.gfs test.gml
```
<img width="781" height="363" alt="Image" src="https://github.com/user-attachments/assets/e030329e-9165-4e0d-841b-ef39b886916c" />
### Steps to reproduce the issue
1. Open Layer - Data Source Manager - Vector tab.
2. Select test.gml
3. Set `GML_ATTRIBUTES_TO_OGR_FIELDS` set to `YES`
4. Add the GML to QGIS
5. Open layer properties - Fields tab and see that only `field1` is present (apart from the ID and extent fields)
### Versions
Note I'm a couple of point releases behind, the flatpak maintainers haven't updated recently, but this behaviour is also present in the 3.44.9 LTS (as noted in GIS SE Q&A linked above)
<table width='100%' align='center'><tr><td>QGIS version</td><td>3.44.7-Solothurn</td></tr><tr><td>QGIS code branch</td><td><a href="https://github.com/qgis/QGIS/tree/release-3_44">Release 3.44</a></td></tr><tr><td colspan="2"> </td></tr><tr><td colspan="2"><b>Libraries</b></td></tr><tr><td>Qt version</td><td>5.15.18</td></tr><tr><td>Python version</td><td>3.13.11</td></tr><tr><td>GDAL version</td><td>3.12.2 — <i>Chicoutimi</i></td></tr><tr><td>PROJ version</td><td>9.8.0</td></tr><tr><td>EPSG Registry database version</td><td>v12.049 (2026-02-14)</td></tr><tr><td>GEOS version</td><td>3.14.1-CAPI-1.20.5</td></tr><tr><td>SQLite version</td><td>3.50.4</td></tr><tr><td>PDAL version</td><td>2.10.0</td></tr><tr><td>PostgreSQL client version</td><td>18.3</td></tr><tr><td>SpatiaLite version</td><td>5.1.0</td></td></tr><tr><td>QWT version</td><td>6.3.0</td></tr><tr><td>QScintilla2 version</td><td>2.14.1</td></tr><tr><td>OS version</td><td>KDE Flatpak runtime</td></tr><tr><td colspan="2"> </td></tr><tr><td colspan="2"><b>Active Python plugins</b></td></tr><tr><td>profile_manager</td><td>0.7.4</td></tr><tr><td>QuickOSM</td><td>2.5.1</td></tr><tr><td>zoom_level</td><td>0.3.3</td></tr><tr><td>pointsamplingtool</td><td>0.5.5</td></tr><tr><td>qgis_notebook</td><td>0.6.0</td></tr><tr><td>kmltools</td><td>3.2.3</td></tr><tr><td>quick_map_services</td><td>1.1.0</td></tr><tr><td>grassprovider</td><td>2.12.99</td></tr><tr><td>processing</td><td>2.12.99</td></tr><tr><td>db_manager</td><td>0.1.20</td></tr></table>
### Supported QGIS version
- [ ] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule).
### New profile
- [ ] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles)
### No Duplicate of the Issue
- [x] I have verified that there are no existing issues raised related to my problem.
### Additional context
Workaround is to create a QGIS environment variable and set the open option:
- Remove the layer/s from QGIS,
- Delete the .gfs file automatically created by the GDAL GML driver,
- Open QGIS Settings-Options-System
- Set a new environment variable `GML_ATTRIBUTES_TO_OGR_FIELDS` value YES
- Close and reopen QGIS and re-add the GML layer/s
<img width="1021" height="694" alt="Image" src="https://github.com/user-attachments/assets/a47b98d8-94d7-4a28-be18-815c1c2239a6" />
1 polubienie
Nie wiem, ale się dowiem…
A czy przypadkiem schemat .XSD nie powinien być strażnikiem od tego by chronić użytkownika od nieporawnego odczytu pliku .GML ?
borys
27 Listopad 2026 15:34
4
Sam XSD nie może być strażnikiem, bo nie ma sprawczości GDAL ma dwa sterowniki: GML i GMLAS (od GML Application Schema):
ogrinfo -al -so plik.gml
ogrinfo -al -so GMLAS:plik.gml
Pierwszy próbuje odwzorować XML jako płaską tabelę atrybutów i porzuca nieobsługiwane elementy, drugi odwzorowuje relacyjną strukturę i traktuje XSD poważnie, więc powinien zgłosić błąd, jeśli nie jest w stanie wszystkiego wczytać. To jeszcze nie znaczy, że QGIS będzie w stanie skonsumować wszystko, co GDAL wczyta.
Tyle teorii, bo zupełnie nie jestem GML-owcem, ale należałoby sprawdzić, na jakim etapie te złożone struktury się gubią.
3 polubienia
Ale nie ma co winić międzynarodowego oprogramowania, że nie wczytuje poprawnie jakiejś egzotyki ze środkowej Europy natywnie. Powinna być wtyczunia do pełnej poprawnej obsługi, w tym walidacji, i tyle
borys
27 Listopad 2026 18:39
6
Tu nie chodzi o egzotykę. QGIS natywnie obsługuje tylko Simple Features w GML-ach (przynajmniej lokalnych, bo w WFS i OGC Api Features jest trochę lepiej). Może to jest zadanie dla SQP, żeby zacząć zbierać fundusze na pełną obsługę Complex Features na podstawie samego XSD? To by wpuściło QGIS-a do sporej niszy i to nie tylko centralnoeurpejskiej, ale paninspirejskiej (a i na innych kontynentach zapewne mają podobnie). Ale prosto nie będzie:
https://github.com/qgis/QGIS-Enhancement-Proposals/issues/277#issuecomment-1809999612
Może ta wtyczka jest jakimś punktem wyjścia?
https://github.com/BRGM/gml_application_schema_toolbox