Why does PostGIS installation not create a template_postgis?

You can quite easily create the template if it is not there automatically. Here is a description for ubuntu: http://obsessivecoder.com/2010/02/01/installing-postgresql-8-4-postgis-1-4-1-and-pgrouting-1-0-3-on-ubuntu-9-10-karmic-koala/

This is the essential part:

sudo su postgres
createdb template_postgis
createlang plpgsql template_postgis
psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis.sql
psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql

In Precise Pangolin:

sudo su postgres
createdb template_postgis
psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql

From version 2 Postgis is enabled by using the extension system. To spatially enable a database, log to your database and then:

 CREATE EXTENSION postgis;
 CREATE EXTENSION postgis_topology;

source: http://postgis.net/docs/postgis_installation.html

Note: Only SUPERUSERS roles have the ability to create EXTENSIONS


I had similar issues and ended up installing the package found at:

entreprisedb.com

you can select installing postgis during the installation phase or call 'Application Stack Builder' later on. If the installation doesn't work, select another folder to download the postgis installer (which will be called something like edb_postgis_1_5_pg91.app.zip ). Unpack the zip and install. If it doesn't work you may want to reboot and try again. In pgAdmin III template_postgis should appear.