importing osm file into a postgres/postgis database importing osm file into a postgres/postgis database postgresql postgresql

importing osm file into a postgres/postgis database


You need to install the postgis extensions into your postgres database. Assuming that you have postgis installed on your machine you need to do something like:

psql <database> < /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql

The exact path to postgis.sql will depend on the distribution you are using and how it has packaged postgis. You may also want/need to install the spatial reference systems table with a command like this:

psql <database> < /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql


This is an example command:

osm2pgsql -c -d your_country -U postgres -W -H localhost -P 5432 -s -k -x -p osm -S default.style ..\your_country.osm.bz2

Here are some useful weblinks:http://wiki.openstreetmap.org/wiki/Osm2pgsqlhttp://www.gis.hsr.ch/wiki/Osm2pgsql

-S.