Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 instals the server and allows you to use the StackBuilder to download and install PostGIS. This doesn't fix my problem.


share|improve this question
up vote 25 down vote accepted

You can quite easily create the template if it is not there automatically. Here is a description for ubuntu:

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
share|improve this answer
Strange.. at step 'createlang plpgsql postgistemplate' I get a $ "plpgsql" is already installed in database "postgistemplate"... and then on the next step, psql: command not found – Michael Markieta Jan 29 '12 at 16:46
Update - There is no postgis directory in the /usr/share/ path – Michael Markieta Jan 29 '12 at 16:51
Then I guess it's hidden somewhere else on OSX. Have you tried searching for the files? – underdark Jan 29 '12 at 17:12
Found the files, all lines of code run without errors. But pgAdmin3 doesn't show the template still... Hrmm.. Restarted my Mac to see if that would change anything, but still nada. (strange... I had this working on my Mac before the switch to Lion) – Michael Markieta Jan 29 '12 at 18:09
Which user did you use to create the template and which user are you using in pgAdmin? – underdark Jan 29 '12 at 18:58

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_topology;


Note: Only SUPERUSERS roles have the ability to create EXTENSIONS

share|improve this answer

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

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 ). 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.

share|improve this answer

The question may be outdated but I ran into the same error on OS X Lion. Maybe my answer could help another user.

The default installation of PostGIS with "stack builder" will fail. But after the first installation step, you can choose the download folder for PostGIS. Just download it to your desktop and unzip it by hand. By doubleclicking the file, it will install properly. The postgis_template is now available in the pgAdmin.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.