Opened 11 years ago

Closed 11 years ago

#4511 closed defect (fixed)

OGR throws error when trying to convert empty KML

Reported by: alexbruy Owned by: warmerdam
Priority: normal Milestone: 1.10.0
Component: default Version: 1.9.0
Severity: normal Keywords: kml


OGR can't show info, open or convert empty KML files (see attachment). The error is

ERROR 4: No layers in KML file: empty.kml.
FAILURE: Unable to open datasource `empty.kml' with the following drivers

But it works with empty shapefiles. This bug makes impossible adding empty KML files to QGIS for editing. Tested with OGR 1.8.1 and 1.9.0

Attachments (1)

empty.kml (1.9 KB ) - added by alexbruy 11 years ago.
Sample emtpy file

Download all attachments as: .zip

Change History (4)

by alexbruy, 11 years ago

Attachment: empty.kml added

Sample emtpy file

comment:1 by Even Rouault, 11 years ago

I'm afraid I don't understand the point in opening empty KML files in QGIS. The KML driver doesn't support editing (SetFeature()). It only supports appending features to a brand new KML file. So the point in opening empty KML files in QGIS seems to be moot.

comment:2 by snodnipper, 11 years ago

Totally agree that this is a minor issue.

Users do, however, receive 'valid' KML files which are occasionally empty - which can be for good reason, e.g. automated download of KML from sensors. In QGIS they currently receive a file 'is not a valid or recognized data source' message. They then choose other (proprietary) products to check that this is not a problem with QGIS and verify that the files do not indeed contain any data.

Unfortunately such activity attracts negative comments and so any (hopefully minor) workaround would be great.

comment:3 by Even Rouault, 11 years ago

Milestone: 2.0.0
Resolution: fixed
Status: newclosed

r23978 /trunk/ (12 files in 3 dirs): KML (old driver): report empty layers when there is only empty layers; don't error out on empty document (#4511)

QGIS now accepts the attached empty.kml. But I'd note that QGIS refuses to open a OGR datasource without any layer in it (but this is a QGIS "defect")

Note: See TracTickets for help on using tickets.