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.

After installing postgresql with postgis under windows xp I have 3 databases:

postgis
postgres
template_postgis

now I try to create a new spatially enabled database in pgAdminIII: I select template_postgis in the pgAdminIII object browser and via rightclick in the context-menu I select new object ->new database. when I try to use this database in QGIS with the spit-plugin I get the following error message:

the chosen database does not have PostGIS installed, but this is required for storage of spatial data.

How do I create a working spatial postgis database? please help a rookie

thanks

Kurt

share|improve this question
    
selecting template_postgis and then clicking into the PgAdmin III toolbar to "create a new object of the same type as the selected object" (= blue arrow -icon) also doesnt work –  Kurt Mar 2 '12 at 21:41
    
I did follow Stéphane's tip:Right-click on any database, choose New Database, fill Name and Owner and, under Template, choose template_postgis. Let me know if that works? But when I Right-click on any database, choose New Database, fill Name and Owner and, under Template, choose template_postgis......, I got an error told me that this template, say template_postgis_20, is being used by other users, so I can't create an new database, how can I do? –  Heinz Apr 1 '13 at 10:16
    
I had the same error after initially installing PostGIS/PosgreSQL with PgAdmin. After rebooting, I didn't get the error message and the new postgis database was created –  user12711 Apr 22 '13 at 3:05

2 Answers 2

up vote 8 down vote accepted

Right-click on any database, choose New Database, fill Name and Owner and, under Template, choose template_postgis. Let me know if that works?

share|improve this answer
    
Stéphane, it works - thank you very much for your support. choosing the template_postgis did the trick!! –  Kurt Mar 2 '12 at 22:40
    
Good, by the way, to check that your DB is PostGIS-enabled, verify that you have the tables geometry_columns and spatial_ref_sys in your schema public. And also the view geography_columns (as of PostGIS 1.5, I believe) –  Stéphane Henriod Mar 5 '12 at 10:20

Within PgAdmin make a new database. Then click on the database, click on the SQL icon enter image description here

In the SQL paste the following line:

CREATE EXTENSION postgis;

Then press the run icon. That should create the postgis functionality in that database.


This approach works for PostGIS 2.0, but not apparently for PostGIS 1.5 ( I tested both on Win 7).

share|improve this answer
    
clenius, on my system this prodcues an error: no such file or directory SQL State 58P01 –  Kurt Mar 2 '12 at 22:45
    
clenius, thank you for your support! yes i am using Postgis 1.5 ps. after further investigations I found an other way to make a nonspatial database spatial is to run the deliver postgis.sql. this should work also on non-windos-systems –  Kurt Mar 3 '12 at 23:37

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.