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

Ævar Arnfjörð Bjarmason avarab at gmail.com
Tue Mar 2 12:07:15 GMT 2010


I maintain some statistics on the country dump for Iceland so as part
of a daily cronjob I do:

    * drop database osm_iceland;
    * cd rails_port && rake db:migrate
    * osmosis import Iceland.osm

Is it possible to to skip the step where I have to maintain a database
copy of the rails port? I've tried script/contrib/apidb_0.6.sql in the
osmosis distribution as well as using
examples/pgsql_simple_schema_0.6.sql with the appropriate
createdb/createlang statements & a postgis setup but I always get
"Unable to check if user with id -1 exists in the database." from
org.openstreetmap.osmosis.core.apidb.v0_6.impl.UserManager.doesUserExistInDb(UserManager.java:96).

It would be really nice if there was an option in osmosis that I could
use to tell it to create a simple database from a given .osm file from
scratch, I.e. do the required CREATE TABLE operations to populate
something like an apidb with nodes/ways/relations and their tags.

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 (<>) {}.

Consider this mainly a feature request. If someone's interested in
implementing SQLite support I can help with that, I'm just lost with
Java.




More information about the dev mailing list