Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

importing osm file into a postgres/postgis database

Im using the tool osm2pgsql to import an osm file into a postgres database using phppgadmin as the administrative tool. i have only downloaded a small town from osm in xml format and im having trouble importing it using the terminal on mac. Im a bit of a noob at this so any help would be greatly appreciated. Ive looked at several articles but none provide the clarity i need in order to fulfill my needs.

Thanks

im getting this error could be something small not sure..

Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE:  table "planet_osm_point" does not exist, skipping
NOTICE:  table "planet_osm_point_tmp" does not exist, skipping
SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, 'POINT', 2 );
 failed: ERROR:  function addgeometrycolumn(unknown, unknown, integer, unknown,     integer) does not exist
LINE 1: SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, ...
           ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
like image 940
John Avatar asked Jul 01 '11 09:07

John


1 Answers

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
like image 104
TomH Avatar answered Sep 30 '22 15:09

TomH