[gdal-dev] New OGR driver to read OpenStreetMap .osm / .pbf files
even.rouault at mines-paris.org
Wed Jul 18 11:09:21 PDT 2012
Selon Jukka Rahkonen <jukka.rahkonen at mmmtike.fi>:
> Even Rouault <even.rouault <at> mines-paris.org> writes:
> > Hi,
> > Following the recent brainstorming with Jukka, I've pushed into trunk a
> > to read OpenStreetMap .osm / .pbf files .
> Driver seems to do what it promises. It is super fast in converting POI data
> because it is possible to skip the slower layers (lines, polygons and
> the tricky multipolygons). Speed with my slow Windows laptop is at least
> converted POIs per minute. However, select with SQL feels sub-optimal.
Yes, when you use ogr2ogr with explicit layer names, there are optimizations.
For example, when you only specify the layer 'points', the OSM driver will not
even try to index the nodes into the temporary database because it is not
needed. However, as you noticed, there is not yet any optimization when a SQL
request is specified.
> It is
> much faster to convert all the points than select only a part of those. The
> error message suggest that ogr2ogr is inspecting the input file more closely
> than necessary for this use case:
> ogr2ogr -f "ESRI Shapefile" poitest.shp finland.osm.pbf
> -sql "select name, amenity from points where amenity='toilets'"
> ERROR 1: Too many features have accumulated in lines layer. Use
> READING=YES mode
You can easily transform the above SQL into something equivalent that will
benefit from the optimization :
ogr2ogr poitest.shp finland.osm.pbf points -select name,amenity -where
> -Jukka Rahkonen-
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
More information about the gdal-dev