Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#5205 closed defect (fixed)

Reading empty MTK GML files returns None

Reported by: tpikonen Owned by: warmerdam
Priority: normal Milestone: 1.11.0
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords: MTK GML
Cc:

Description (last modified by tpikonen)

Trying to read an MTK GML file which does not have any actual data, just container tags with python-ogr results in a NoneType? object:

from osgeo import ogr
ff = ogr.Open('/tmp/K23441.xml')
type(ff)
-> NoneType

The file in question is part of the official Finnish land survey database and can be downloaded e.g. here: http://kartat.kapsi.fi/files/maastotietokanta/kaikki/etrs89/gml/K2/K23/K23441_mtk.zip

This feature makes some conversion scripts (like ogr2osm) fail, so it would be nice to get an empty osgeo.ogr.DataSource? object from empty containers, if possible.

Non-empty files work fine with the MTK GML driver, so thanks for that!

Change History (3)

comment:1 Changed 4 years ago by tpikonen

Description: modified (diff)

comment:2 Changed 4 years ago by Even Rouault

Component: defaultOGR_SF
Milestone: 2.0
Resolution: fixed
Status: newclosed

trunk r26339 "GML: open successfully GML datasources with 0 layers (#249, #5205)"

comment:3 Changed 4 years ago by Even Rouault

Milestone: 2.01.11.0
Note: See TracTickets for help on using tickets.