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

Even Rouault even.rouault at mines-paris.org
Tue Jul 10 20:18:10 BST 2012


This is a forward of an email I just send on the gdal dev mailing list :

Following the recent brainstorming with Jukka, I've pushed into trunk a driver 
to read OpenStreetMap .osm / .pbf files .

No particularly exotic dependencies : SQLite (and Expat for OSM XML files)

See http://www.gdal.org/ogr/drv_osm.html for the details (will be available in 
a few hours).

The performance to convert 
http://download.geofabrik.de/osm/europe/finland.osm.pbf into a Spatialite DB is 
the following one on my PC (Core i5 @ 2.67 GHz with 64bit GDAL) :

$ time ogr2ogr finland.sqlite finland.osm.pbf -f SQLite -dsco SPATIALITE=YES -gt 
10000 -progress --config OGR_SQLITE_SYNCHRONOUS OFF

real    4m31.194s
user    3m33.020s
sys 0m46.070s

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.

The data/osmconf.ini configuration file is pretty basic and its settings could 
likely be improved with some tweaking. Contributions welcome.

An improved version of the driver could allow specifying custom layers, 
instead of the 4 fixed ones.

Happy testing,


PS: I'm not sure if this is the right list @openstreetmap.org for that kind of 

More information about the dev mailing list