PostGIS Installation – Fixing Missing template_postgis

postgispostgresql

I went this route for installation of PostgreSQL and PostGIS:

Now when I launch pgAdmin and try to create a new PostGIS database, there is no template_postgis for use in Template.


I have tried going another route, that is downloading the PostgreSQL package directly from PostgreSQL. This installs the server and allows you to use the StackBuilder to download and install PostGIS. This doesn't fix my problem.

Best Answer

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