Bug report #20098
getFeatures() can't be run twice on an OSM file
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Even Rouault | ||
Category: | Data Provider/OGR | ||
Affected QGIS version: | 3.3(master) | Regression?: | Yes |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 27920 |
Description
Since this commit https://github.com/qgis/QGIS/commit/f410b4a4da07463a25786045b107282dffabf1bd, the python iterator getFeatures() can't be run twice on an OSM file:
l = QgsVectorLayer('/tmp/request-jY9056.osm|layername=multipolygons', "test", "ogr") print('first loop') for f in l.getFeatures(): print(f.id()) print('second loop') for f in l.getFeatures(): print(f.id()) print('end loops')
It gives:
exec(open('/home/etienne/quickosm.py'.encode('utf-8')).read()) first loop 65738329 65739173 65744728 65759782 second loop end loops
It was working fine the commit before.
This breaks the QuickOSM plugin: https://github.com/3liz/QuickOSM/issues/125
Thanks
Associated revisions
[OGR provider] Make again a feature iterator to be resetable on a OSM layer (fixes #20098)
Merge pull request #8184 from rouault/fix_20098
[OGR provider] Make again a feature iterator to be resetable on a OSM layer (fixes #20098)
History
#1 Updated by Etienne Trimaille about 6 years ago
Using GDAL/OGR 2.2.3 on Ubuntu 18.04
#2 Updated by Even Rouault about 6 years ago
- Assignee set to Even Rouault
#3 Updated by Even Rouault about 6 years ago
#4 Updated by Even Rouault about 6 years ago
- % Done changed from 0 to 100
- Status changed from Open to Closed
Applied in changeset qgis|906f80219f726ce36d8a23fb758938bdf8a75db1.