[OSM-talk] planet.osm Database import

Immanuel Scholz immanuel.scholz at gmx.de
Tue Apr 25 11:53:36 BST 2006


>> If there is a real need for a standard importer to import the
>> planet.osm Data
>> into a database I can try to write it.
> Yes please!
> Ideally something that runs in a widespread scripting language without
> installing _too_ many XML libraries. ;)

I've done something as some exercise for learning ruby. It's a ruby script
that read the planet.osm into a sqlite database. Here is the database
structure (I used the most simple layout I could think of):

create table tag (uid integer, key varchar(200) not null, value

create table node (id integer primary key, timestamp timestamp, lat float
not null, lon float not null);

create table segment (id integer primary key, timestamp timestamp,
from_node_id integer unique, to_node_id integer unique);

create table way_segment (way_id integer, segment_id integer);

create table way (id integer primary key, timestamp timestamp);

I use it to do some more advanced command-line-queries instead of grepping
the xml every time, but I think a simple WMS server could be setup out of
this easily.

> (or a mysql dump would do just as well)

Well, I don't see any sqlite specific things here, so it should run under
mysql as well.

I cannot upload to svn now, if anyone interested, mail me - i'll send it
to you.

Ciao, Imi.

More information about the talk mailing list