[Qgis-developer] python/ogr problems reading large gml file

Richard Duivenvoorde rdmailings at duif.net
Mon May 2 06:38:45 PDT 2016


Hi Devs,

(below all via python/plugin on Debian/Linux):

Via a WFS I retrieve 10000 features as GML as data.gml
To be able to read (attr+geometry) the GML I copy a data.gfs next to it.

Now all seems ok, untill the number of features returned is > 1500.
Strange errors like:

ogrinfo -ro data.gml reports a (None) geometry
BUT if I 'touch' the data.gfs ogrinfo, then suddenly all is ok
Seems like ogrinfo does not like the copied gfs at first?
Permissions are ok. A 'touch /tmp/foo/data.gfs' is enough.

Off course the same holds for QGIS, if I open the retrieved and saved
gml file as a gml-vectorlayer, a 1000 feature containing one is probably
ok, but <1500 often fails and the 10000 one ALWAYS fails (untill I
'touch' the gfs file).
IF something goes wrong: there is no exception, and 'layer.isValid()'
returns true, but geometry/attributes are None at such moment.

I'm pretty carefull with closing/opening the files (I think), but it
smells like either files that are still open, OR python loosing it's
handles or so?

Anybody some idea on what I am doing wrong?
Sorry, cannot sent you a wfs-url it's an internal service here.

Thansk for any pointers

Regards,

Richard Duivenvoorde


More information about the Qgis-developer mailing list