osm2pgsql: Function AddGeometryColumn doesn't exist
It looks like you haven't added PostGIS support to the database you're trying to use osm2pgsql.exe
on. See the PostGIS installation documentation (2.0).
Since you are using PostGIS 2.0, you should be able to just CREATE EXTENSION postgis;
to load PostGIS. This command must be run as a superuser - normally the user postgres
. Use:
psql -U postgres mydbname
to connect as user postgres
.
It appears that at least the Windows builds of osm2pgsql
don't support PostGIS 2.0 - or didn't about six months ago, anyway. See this issue report on the OSM GitHub, and the instructions on how to set a PostGIS 2 database to be compatible with an osm2pgsql that expects PostGIS 1.x. Future readers should check that these steps are still actually required before proceeding; it's likely that osm2pgsql
for Windows will be updated to support PostGIS 2 at some point.
Rather late but I stumbled and tripped upon this Sept '16. The SQL line:
SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, 'POINT', 2 );
needs to be rewritten as this function signature:
('catalog','schema','table','column',srid,'type',type_mod,boolean)
;
White space is immaterial. So something like the following should do the trick:
SELECT AddGeometryColumn('','','planet_osm_point', 'way', 900913, 'POINT', 2,true );
Check one of the actual INSERT statements for the correct column name which in my version is 'geom'.
Ensure that varchars are quoted, integers and boolean are unquoted and of course that the right values are in the places.
Good luck.