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'm trying to understand how to install PostGIS2.0 on Windows7. The PostGIS site has the following suggestions:

PostGIS Experimental Binaries PostGIS 2.0.0SVN Binaries with Raster, Topology support + Extras (Tiger Geocoder 2010) As of November 25th, 2011 (r8242) includes GEOS 3.3.2dev r3516, Proj 4.6.1, JSON-c 0.9, libgdal 1.9 SVN r23320 (VERSIONS prior to (r7923) require a dump reload since operators have changed. We now have the 3D spatial indexes, 3D box operators, KNN GIST for 9.1, and 2 raster map algebra)

More details about what has been fixed/added can be found at PostGIS 2.0.0 and PostGIS 1.5.3/1.5.4 fixes , What is new in PostGIS 2.0, PostGIS Raster support, and improved Topology support These are 32-bit binaries so will not work on 64-bit PostgreSQL. We are working on getting 64-bit binaries out as well, but are running into some stumbling blocks. For the time being -- if you are on Windows 64-bit, you must install the 32-bit PostgreSQL to use these.

For PostgreSQL 8.4 w/ Loader/Dumper including GUI
For PostgreSQL 9.0 (compiled against PostgreSQL 9.0.3) w/ Loader/Dumper including GUI
For PostgreSQL 9.1 (compiled against PostgreSQL 9.1.0 - note 9.1 structure changed in beta 1 so this will not work with alpha releases

but should be fine for all beta, release candidate releases and final 9.1.0 release) w/ Loader/Dumper including GUI. Also includes extensions files to install using new PostgreSQL 9.1+ CREATE EXTENSION syntax. To install:

First copy the share/extension files into your PostgreSQL share/extension folder.

Then in any database you'd like to spatially enable, run at least postgis (which contains both geometry and raster support) and

optionally postgis_topology commands.

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;

I currently have PostGIS 1.5 installed on PostgreSQL 8.4. This is what my folder structure looks like:

enter image description here

I don't fully understand these instructions:

First copy the share/extension files into your PostgreSQL share/extension folder.

Then in any database you'd like to spatially enable, run at least postgis (which contains both geometry and raster support) and optionally postgis_topology commands.

I've downloaded postgisgui_pgadmin-2.0.0svn and postgis-pg84-binaries-2.0.0svn. In my original folder structure I don't have a folder extension within share. Do I just copy the contents of postgis-pg84-binaries-2.0.0svn into this folder? What does it mean to run at least postgis? I've also tried to follow the detailed instructions at the following blog.


EDIT: I have installed Postgresql 9.1 with PostGIS 1.5.3. I am trying to figure out where to copy the PostGIS 2.0 binaries. It seems like I should be copying them into the folders here:

enter image description here

but the advice suggests placing them in the share/extension folder.

I tried copying the entire folder into share/extension/ and then editing the makepostgis.bat file to make it relevant to my file system (the port is 5434 as I have two instances of Postgresql running).

set PGPORT=5434 
set PGHOST=localhost
set PGUSER=postgres
set PGPASSWORD=****
set THEDB=template_postgis20
set PGBIN=C:\Program Files (x86)\PostgreSQL\9.1\bin\
set PGLIB=C:\Program Files (x86)\PostgreSQL\9.1\lib\

When I run this file as an administrator, I get the following error:

C:\Windows\system32>set PGPORT=5434    
C:\Windows\system32>set PGHOST=localhost    
C:\Windows\system32>set PGUSER=postgres    
C:\Windows\system32>set PGPASSWORD=****    
C:\Windows\system32>set THEDB=template_postgis20    
C:\Windows\system32>set PGBIN=C:\Program Files (x86)\PostgreSQL\9.1\bin\    
C:\Windows\system32>set PGLIB=C:\Program Files (x86)\PostgreSQL\9.1\lib\    
C:\Windows\system32>set POSTGISVER=2.0    
C:\Windows\system32>xcopy bin\*.* "C:\Program Files (x86)\PostgreSQL\9.1\bin\"
File not found - *.*
0 File(s) copied

C:\Windows\system32>xcopy /I /S bin\postgisgui\* "C:\Program Files (x86)\PostgreSQL\9.1\bin\\postgisgui"
File not found - *
0 File(s) copied

C:\Windows\system32>xcopy lib\*.* "C:\Program Files (x86)\PostgreSQL\9.1\lib\"
File not found - *.*
0 File(s) copied

C:\Windows\system32>"C:\Program Files (x86)\PostgreSQL\9.1\bin\\psql"  -c "CREATE DATABASE template_postgis20"
ERROR:  database "template_postgis20" already exists

C:\Windows\system32>"C:\Program Files (x86)\PostgreSQL\9.1\bin\\psql"  -d "template_postgis20" -c "CREATE LANGUAGE plpgs
ql"
ERROR:  language "plpgsql" already exists

C:\Windows\system32>"C:\Program Files (x86)\PostgreSQL\9.1\bin\\psql"  -d "template_postgis20" -f "share\contrib\postgis
-2.0\postgis.sql"
share/contrib/postgis-2.0/postgis.sql: No such file or directory

....the errors continue....
share|improve this question
    
@underdark, I think it is wrong to say this is about upgrading. It is about installing PotGIS 2.0 as they can live together in the db-cluster. In a specific database they cannot and I guess that is not the intention in the question, but to install PostGIS 2.0 in a new database. –  Nicklas Avén Dec 6 '11 at 12:51
    
@Nicklas Originally, I was intending to install PostGIS2.0 in the same cluster. Can I have several Postgresql instances on the same computer? It seems like it would be easier to install both; so long as they don't interfer with the current installation. –  djq Dec 6 '11 at 14:24
    
So the question would be how to run two versions in parallel? –  underdark Dec 6 '11 at 14:57
    
I think it is now. I want to have both 1.5.3 and 2.0 running; I didn't realize they need to be on separate postgresql servers. –  djq Dec 6 '11 at 15:45
    
no, not on different servers. just different databases –  Nicklas Avén Dec 6 '11 at 19:29

2 Answers 2

up vote 4 down vote accepted
+100

I've updated the instructions on the website. Hope it's a bit clearer.

Nicklas is right you don't really need the makepostgis.bat if you just copy the like folders to your postgresql install (you could also remark out the create db in it since it does copy all the files). You should be able to just overlay ontop since the zip structure is the same as standard windows enterprisedb packaged PostgreSQL binaries. What I neglected to mention in the instructions is that you do still need the binaries and libs. This I have updated so its should be clearer.

We don't have the create extension approach as the official for PostgreSQL 9.1 yet since we are working out some issues with using the ALTER EXTENSION postgis UPGRADE .. syntax which is more of an issue with PostGIS 2.0 non-released since there are no official freeze points yet. In the currently packaged it works fine but its harder to ensure it works given all the flux of stuff going on in PostGIS 2.0 in the past month.

share|improve this answer
    
Thanks @LR1234567 I've tried copying everything into the respective folders on my Postgresql 9.1 installation. When I create a db in postgresql (choosing template postgis2.0); I get an error when I run CREATE EXTENSION postgis; The error is: ERROR: type "spheroid" already exists, SQL state: 42710 –  djq Dec 15 '11 at 15:29
    
Celenius, I think your issue is your are trying to create a template postgis 20 with functions already installed and then trying to do CREATE EXTENSION.. You do one or the other not both. So create a fresh postgresql database -- don't install any postgis functions. Then in that db do CREATE EXTENSION .... In the next release -- we'll include a separate batch script that does the create extension stuff so hopefully it will be clearer. –  LR1234567 Dec 20 '11 at 19:29
    
Thanks @LR1234567, running CREATE etc... by itself appeared to work. I was able to load a shapefile into that database and am currently trying to load a raster. I'm finding your book very helpful too. –  djq Dec 21 '11 at 15:37

Edit:

The reason that you don't have the extension folder is that you are not on PostgreSQL 9.1 when the extension feature was introduced.

What you should do is put the binaries in the bin-folder as described in the beginning of the readme-file.

Then running postgis means that you are supposed to run the sql-code in the file postgis.sql to install the types and functions in PostGIS into the database. To install raster and topology you will also have to run thosose files.

You can read about that in the installation part of the doc.

/Nicklas

share|improve this answer
    
Hi @Nicklas I just updated my question (and Postgresql to 9.1). I did read the readme but I'm still not clear on where to copy the binaries. –  djq Dec 6 '11 at 20:06
    
ok, if you have upgraded to PostgreSQL 9.1 you should have that extension folder in the share folder in the 9.1 folder and follow that part of the instructions. I have not installed 2.0 in windows myself. –  Nicklas Avén Dec 6 '11 at 20:16
    
I do have the share/extension folder in 9.1. Do I copy everything from the postgis binary folder into share/extension?. The instructions are not clear about what files to copy, or where to copy them. –  djq Dec 6 '11 at 20:26
    
extensions is a new feature in 9.1. the thing is that an extensuon is installed with the "create extension" command. I don't think makepostgis.bat is relevant if you go the extension road, but I am not sure. –  Nicklas Avén Dec 6 '11 at 21:17

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.