What I want to do is import some shape files, using the shp2pgsql loader. However, I need a database first, and I've read I need to make it spatially aware, which means creating it from the "template_postgis". All the docs I read indicate that template_postgis should be present after installing PostGIS. But… When I try to create a database from that template, I'm told it's missing.
> createdb -T template_postgis demo -U postgres
createdb: database creation failed: ERROR: template database "template_postgis" does not exist
> sudo port installed | grep postg
postgis @1.5.3_0+postgresql90 (active)
postgresql90 @9.0.5_0 (active)
postgresql90-server @9.0.5_0 (active)
postgresql_select @0.1_0 (active)
I tried importing a SHP file anyway:
> shp2pgsql -c -D -s 4269 -i -I demo.shp | psql -d demo -U postgres
Postgis type: MULTILINESTRING[2]
NOTICE: CREATE TABLE will create implicit sequence "nrn_ab_8_0_roadseg_gid_seq" for serial column "nrn_ab_8_0_roadseg.gid"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "nrn_ab_8_0_roadseg_pkey" for table "nrn_ab_8_0_roadseg"
ERROR: function addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does not exist
LINE 1: SELECT AddGeometryColumn('','nrn_ab_8_0_roadseg','the_geom',...
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
ERROR: current transaction is aborted, commands ignored until end of transaction block
Appears as though Postgis isn't even 'there'.
(Sorry, I'm a MySQL guy. I'm just trying to get started without asking too many dumb questions.)
Best regards,
René Fournier