[OSM-dev] Using osmosis for a daily from-scratch import into PostgreSQL and SQLite support

Jochen Plumeyer jochen at plumeyer.org
Wed Mar 3 01:57:07 GMT 2010


Dear Ævar Arnfjörð,

On Mar 02 Mar 2010, Ævar Arnfjörð Bjarmason wrote:
> It would be even better if it could write to an SQLite database, then
> it would be trivial to turn a .osm file into a .sqlite file for easy
> querying of the data. There's a lot of tools in the OSM SVN that could
> use something like this but right now they just implement their own
> ad-hoc XML parsing in a while (<>) {}.

I wrote scripts which are using the expat library, no dirty parsing, to 
SQLite:
http://plumeyer.org/osm/osm2sqlite.pl

The bottlenecks of this rather slow script is conversion from date strings to 
UNIX epoch seconds, and the whole SQLite latency, although the data is 
committed in larger chunks.

Another script which is generating an SQL dump file, this is about 4 times 
faster than the former script, and should work with MySQL and PostgreSQL as 
well:
http://plumeyer.org/osm/osm2sql.pl

It aims towards SQL92 compliance, I did not test its output yet, let me know 
if it needs finishing.

Cheers,

Jochen






More information about the dev mailing list