[Qgis-developer] ogr osm provider seems broken

Even Rouault even.rouault at mines-paris.org
Fri Jun 6 05:55:03 PDT 2014


Le vendredi 06 juin 2014 14:48:01, Richard Duivenvoorde a écrit :
> On 06-06-14 14:26, Even Rouault wrote:
> > 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:
> > 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.
> 
> Mmm, ok. Get your point. But then QGIS is broken for this kind of
> datasources in my opinion.
> 
> I can only view them on the map? I should at least be able to view the
> attributes, or run an algorithm on a small dataset like the one attached
> to the tickets.
> 
> My point is that QGIS is able to run over the features to show them, and
> also show the information of the features via the i-tool, I can even
> classify them...
> 
> I would think that it would be possible to run over the features in one
> way or another to either show the attribute table, or do some simple
> algorithms like buffer.
> 
> If not... then I think we should at least warn users for this kind of
> issues.

I've not dived in QGIS code to know why it works for some stuff and not for 
others, but fundamentally the way the driver works requires special handling 
in the code using the driver. My recommandation would be to use ogr2ogr to 
convert the osm file into spatialite or postgis and work with the converted 
files

> 
> Regards,
> 
> Richard Duivenvoorde

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the Qgis-developer mailing list