Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

Ideas?

share|improve this question

4 Answers 4

up vote 19 down vote accepted

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

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.

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 an other 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

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

share|improve this answer

Your Answer

 
discard

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.