osm2pgsql

Published in

osm2pgsql

Der Konverter osm2pgsl konvertiert die XML-Daten nach PostgreSQL/Postgis.
Eine Windows-Version liegt unter http://tile.openstreetmap.org/direct/osm2pgsql.zip, ansonsten empfiehlt sich das selber kompilieren, die Quellen liegen im OSM subversion-repository.

Verfahren mit osm2pgsl

DB anlegen

Einige Hinweise stehen in der Mapnik-Doku unter http://wiki.openstreetmap.org/index.php/Mapnik
und http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS

Daten einlesen:
* Datei default.style muss im aktuellen Verzeichnis liegen
* Datenbank kann angegeben werden
* Benutzer muss Berechtigungen auf spatial-Tabellen haben

ALTER TABLE geometry_columns OWNER TO username;
ALTER TABLE spatial_ref_sys OWNER TO username;
 

es werden Einträge in den Tabellen vorgenommen, sonst funktioniert es nicht
==================================
 

D:\daten\OSM>c:\Programme\osm2pgsql\osm2pgsql.exe -U osm -W -d osm niedersachsen.osm.bz2
osm2pgsql SVN version 0.55-20081113 $Rev: 10464 $

Password:
Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, 'POINT', 2 );
failed: ERROR: permission denied for relation geometry_columns
CONTEXT: SQL statement "DELETE FROM geometry_columns WHERE
f_table_catalog = '' AND f_table_schema = 'public' AND f_table_n
ame = 'planet_osm_point' AND f_geometry_column = 'way'"
PL/pgSQL function "addgeometrycolumn" line 102 at EXECUTE statement
SQL statement "SELECT AddGeometryColumn('','', $1 , $2 , $3 , $4 , $5 )"
PL/pgSQL function "addgeometrycolumn" line 4 at SQL statement

Error occurred, cleaning up

==================================

neustart nach Berichtigung der Berechtigung

D:\daten\OSM>c:\Programme\osm2pgsql\osm2pgsql.exe -U osm -W -d osm niedersachsen.osm.bz2
osm2pgsql SVN version 0.55-20081113 $Rev: 10464 $

Password:
Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
Setting up table: planet_osm_line
Setting up table: planet_osm_polygon
Setting up table: planet_osm_roads
Mid: Ram, scale=100

Reading in file: niedersachsen.osm.bz2
Processing: Node(1684k) Way(261k) Relation(1k)
Node stats: total(1684905), max(316719522)
Way stats: total(261296), max(28806765)
Relation stats: total(1365), max(56138)

Writing way(41k)

D:\daten\OSM>