1

I am using osm2psql to import an osm file into a postgres database using the following command:

osm2pgsql -cGs -d osm -S /usr/local/share/osm2pgsql/default.style ~/Downloads/your_file.osm.pbf

When I run it in terminal I get the following error:

Jonathans-MacBook-Pro:Downloads rjth$ osm2pgsql -cGs -d osm -S
/usr/local/share/osm2pgsql/default.style ~/Downloads/vienna-bratislava.osm.pbf
osm2pgsql SVN version 0.84.0 (64bit id space)
Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE:  table "planet_osm_point" does not exist, skippin
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.
Error occurred, cleaning up

I have already tried TomH suggested for a similar question and I have followed every step of the official tilemill documentation. for the installation option of postgis I have installed postgresapp.

Community
  • 1
  • 1
rjth
  • 95
  • 1
  • 3
  • 12
  • 2
    Is sure looks like `create extension postgis;` either was not done, or failed. If you think that it was done, can you show us the output of the psql session in which you created the postgis extension? – jjanes Feb 24 '14 at 00:09

1 Answers1

1

I was having the same issue.

If create extension postgis was done, then it wasn't with the database osm.

You need to add the extension within the osm database.

rjth$ psql osm
osm=# create extension postgis;

Then run your command to access the osm.pbf file and it should work.

dshkol
  • 1,208
  • 7
  • 23