Opened 11 years ago

Closed 8 years ago

#4427 closed enhancement (wontfix)

Reading GML files containing object classes with multiple data types

Reported by: jwva Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords: GML, map layers, QGIS
Cc:

Description

QGIS (QuantumGIS) 1.7.3 uses OGR/GDAL to read GML 3.x data files. I'm using this to display a GML3 data file. One object class in this GML file ("Roads") consists of multiple data types (points AND lines AND polygons). Apparently GML supports this... Instead of creating three map layers, the OGR import module suggests *one* map layer with data type "unknown", and subsequently reads the data only partially. The Roads are displayed incorrectly.

I'm not really sure whether this is an issue for GDAL/OGR or for QGIS, but the QGIS forum suggests contacting the GDAL mailing lists, since that's the import module they use for reading GML.

Many thanks in advance,

Jan-Willem van Aalst

Attachments (1)

GML_Dutch_Topography_section04E-tempedit.zip (970.3 KB ) - added by jwva 11 years ago.
GML example (Dutch topography) where object class Wegdeel ("roads") contains multiple data types

Download all attachments as: .zip

Change History (8)

comment:1 by Even Rouault, 11 years ago

I'd note substantial improvements in GML reading have been made in GDAL 1.8.0 and also in 1.9.0, but I'm not sure they will help in your case. Could you attach an example of the type of GML you are interested in ?

comment:2 by jwva, 11 years ago

I'd like to attach an example, but the Attachment plugin allows only very small attachments. My example is 2Mb zipped (11Mb unzipped), which is refused as "too large".

Can you provide an e-mail address to which I can send the example GML file?

Many thanks.

comment:3 by Even Rouault, 11 years ago

You can probably edit your GML file to only keep a few meaningfull features in it and make it much smaller. This is text file, isn't it ;-) ?

by jwva, 11 years ago

GML example (Dutch topography) where object class Wegdeel ("roads") contains multiple data types

comment:4 by jwva, 11 years ago

Please find attached an example GML file containing the object class "Wegdeel" (roads) with multiple data types (point, line, polygon), as described above.

GDAL should suggest three map layers, one of each data type.

comment:5 by Even Rouault, 11 years ago

Type: defectenhancement

OK, well, after seeing the file, I think OGR behaviour is consistant. It is consistant to report wkbUnknown for a layer with mixed geometry type : POINT and LINESTRING here. For example in PostGIS and other datasources too, you can have a mix of geometry types in the same layer.

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

comment:6 by Even Rouault, 11 years ago

(Note: #4428 includes a fix that will help making the ogr2ogr command line a bit less verbose)

comment:7 by Jukka Rahkonen, 8 years ago

Resolution: wontfix
Status: newclosed

As Even wrote, layers with multiple geometry types are OK in many formats: PostGIS, Oracle, SpatiaLite, GML, OpenJUMP JML.

Note: See TracTickets for help on using tickets.