[OSM-dev] New OGR driver to read OpenStreetMap .osm / .pbf files

Jukka Rahkonen jukka.rahkonen at latuviitta.fi
Tue Jul 31 15:39:07 BST 2012

Even Rouault wrote:
> Le vendredi 20 juillet 2012 20:58:08, Sven Geggus a écrit :
>> Even Rouault <even.rouault at mines-paris.org> wrote:
>> > Testing with larger areas, like whole France or Europe, shows sluggish
>> > performance when ways are built from nodes, but that's perhaps
>> expected.
>> > I didn't compare with other tools to know if the indexing or request
>> > strategy is particularly bad.
>> Hm, would it be possible with this to e.g. convert all the forests
>> from a complete planetfile to a polygon shapefile while discarding
>> all the rest?
> Yes, this should be possible by specifying the appropriate -where clause
> to
> ogr2ogr. However this will have roughly the same performance as completely
> converting the whole planetfile, so it will take some time...
> Hum, actually while writing this, I see that the attribute filter is
> evaluated
> after having reconstructed the geometry. So there's perhaps something I
> can do
> to speed that up a bit, in order to evaluate the attribute filter before
> and
> skip the geometry building if the attribute filter rejects the filter.

I made a test with germany.osm.pbf file from Geofabrik. I used GDAL
development version r24717 and my ogr2ogr command was:

ogr2ogr -f SQlite -dsco spatialite=yes germany_forests.sqlite
germany.osm.pbf polygons multipolygons -gt 20000 --config
OGR_SQLITE_SYNCHRONOUS OFF -where "landuse='forest'" -progress

Execution took 12 minutes. This much landuse=forest areas were found:

Layer name: polygons
Geometry: Polygon
Feature Count: 262683
Layer name: multipolygons
Geometry: Multi Polygon
Feature Count: 6917

There are some more timings and info about the hardware used in the test
in this mail

-Jukka Rahkonen-

More information about the dev mailing list