Bug report #4754

Reading GML file (using OGR/GDAL) doesn't recognize object classes with multiple data types

Added by JW van Aalst over 7 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/OGR
Affected QGIS version:master Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:14623

Description

QGIS reads GML 3.x data files, but doesn't know what to do when it encounters in the GML file an object class with multiple data types. For instance, I have a GML file in which roads are encoded as both lines AND points (crossings) AND polygons (roadsections-width).

Instead of creating three map layers, upon reading the GML file the QGIS import process responds with "Unknown" data type and imports the object data only partially. Of course, there should in this case be three separate map layers (point, line, polygon), which I can then save as ESRI Shapefiles, for instance.

Is this an issue that can be solved in QGIS, or is this an issue for the GDAL/OGR development team?

P.S. I've found that most stand-alone GML viewers encounter a similar challenge in displaying such objects.

History

#1 Updated by JW van Aalst over 7 years ago

Today I've received the follwing reply from the OGR/GDAL development team:

"I think OGR behaviour is consistent. It is consistent to report wkbUnknown for a layer with mixed geometry type: POINT and LINESTRING here. Perhaps QGIS could evolve to take such layers into account, and when reading a layer 'foo' with wkbUnkown, it could split the features into a 'foo_point', 'foo_lines' and 'foo_polygons'. I don't feel it is the OGR responsibility to do that. Or if we do something, it should be done in a generic way, and not in each driver code.
For now, you can do the split with ogr2ogr : {{{
ogr2ogr wegdeel_points.shp "04_oost - tempedit.gml" -sql "select * from wegdeel where OGR_GEOMETRY = 'POINT'" -dialect OGRSQL -overwrite -skip_failures ogr2ogr wegdeel_lines.shp "04_oost - tempedit.gml" -sql "select * from wegdeel where OGR_GEOMETRY = 'LINESTRING'" -dialect OGRSQL -overwrite -skip_failures }}}

I hope this comment helps to solve the issue.

#2 Updated by Paolo Cavallini about 7 years ago

  • Target version set to Version 2.0.0

#3 Updated by Giovanni Manghi over 6 years ago

  • Category deleted (GDAL Tools)

#4 Updated by Jürgen Fischer over 5 years ago

  • Category set to Data Provider/OGR

#5 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Open to Feedback

can you attach sample data?

#6 Updated by JW van Aalst over 5 years ago

This issue has more or less resolved itself through better conversion tools from GML to PostGIS. Reading large GML files directly in QGIS leads to slow performance, whereas first converting GML to PostGIS and then using the PostGIS database in QGIS retains performance.
In other words, as far as I am concerned this issue can be closed.

#7 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to wontfix
  • Status changed from Feedback to Closed

Also available in: Atom PDF