[Qgis-developer] ogr osm provider seems broken
Even Rouault
even.rouault at mines-paris.org
Fri Jun 6 05:26:47 PDT 2014
Le vendredi 06 juin 2014 08:55:39, Richard Duivenvoorde a écrit :
> Hi Devs,
>
> to me the way qgis handles .osm files seems broken, see:
>
> http://hub.qgis.org/issues/10000
>
> http://hub.qgis.org/issues/10427
>
> apparently ogr returns -1 on the number of features, but more important
> the feature interator seems broken
>
> Problems: loading an osm file and viewing the attribute table only shows
> 2 records (while all points are shown on the map).
> Iterating over the features with python also raises errors.
>
> Not sure if we should make this a blocker, because I'm not convinced of
> the importance of .osm files.
Richard,
Jukka pretty much answered rightly the questions in the tickets. The OGR OSM
driver is rather tuned to handle multi-gigabyte .osm/.pbf files, and due to the
structure of those files, it is impossible to count efficiently the number of
features without reading it entirely. Hence -1 returned as the feature count.
If you issue an explicit SELECT COUNT(*) FROM, it means that you know what you
want, and you're ready to wait for it...
And, also related to the structure of the data, the driver is a bit particular
in the sense that the iteratation over features with GetNextFeature() might
not work if the osm file is of a "sufficient size". See the "Interleaved reading"
paragraph of http://www.gdal.org/drv_osm.html.
For such cases, it might be interesting to develop a new concept in OGR, a
whole dataset feature iterator, that could return features from different
layers as soon as they are available.
Best regards,
Even
--
Geospatial professional services
http://even.rouault.free.fr/services.html
More information about the Qgis-developer
mailing list