Installing PostGIS on Windows
You don't have to worry about any of those prerequisites when installing PostGIS on Windows. You just need to install the Postgresql installer for your platform. You can then launch the Application Stack Builder to install PostGIS.
You can find more detailed installation instructions at the Boston GIS web site.
you can check out Portable GIS V3 which is newly released. the package contains what you need about GIS.
- Desktop GIS packages QGIS (with GRASS plugin) version 1.8
- FWTools (GDAL and OGR toolkit)
- Apache2 and Php5
- PostgreSQL (version 9.0)/Postgis (version 1.5)
- Mapserver 5.6 and 6, OpenLayers.
- Python 2.7
- Loader- for loading gml such as Ordnance Survey Mastermap into a PostgreSQL Database
- Utilities- portable firefox, pdf reader and text editor
i hope it helps you...
Thanks to @pateto777 answer and other sources like this and this , I managed to have a "portable" installation of PostGIS on a windows 7 machine without admin rights.
Select the packages and download the binaries zip files. I went for:
- postgresql-9.6.3-3-windows-x64-binaries.zip
- postgis-bundle-pg96-2.3.3x64.zip
Unzip the content in a merged folder, I used "pgsql", so within this folder you will have the folders: bin, doc, gdal-data, include, lib, pgAdmin 4, share, utils, symbols and utils. No "data" folder yet!
Create a cluster before using it. I used a batch file in the merged folder to create it. I called FirstBatch.bat
@ECHO ON
REM The script sets environment variables helpful for PostgreSQL
@SET PATH="%~dp0bin";%PATH%
@SET PGDATA=%~dp0data
@SET PGDATABASE=postgres
@SET PGUSER=postgres
@SET PGPORT=5439
@SET PGLOCALEDIR=%~dp0share\locale
"%~dp0bin\initdb" -U postgres -A trust -E utf8
ECHO "Click enter to exit"
pause
- Start postgresql. I used a batch file in the merged folder to start it. It has to be running while you want to access the database. I called NormalBatch.bat.
@ECHO ON
REM The script sets environment variables helpful for PostgreSQL
@SET PATH="%~dp0\bin";%PATH%
@SET PGDATA=%~dp0\data
@SET PGDATABASE=geodb
@SET PGUSER=postgres
@SET PGPORT=5439
@SET PGLOCALEDIR=%~dp0\share\locale
"%~dp0bin\pg_ctl" -D "%~dp0data" -l logfile start
ECHO "Click enter to stop"
pause
"%~dp0\bin\pg_ctl" -D "%~dp0/data" stop
- While the previous batch is running, create a geodatabase called "geodb". I used this batch to connect to the shell
REM shell interface
"%~dp0bin\psql" -p 5439 -U postgres
then type:
postgres=#create database geodb;
postgres=#\connect geodb;
geodb=#CREATE EXTENSION postgis;
geodb=#CREATE EXTENSION postgis_topology;
geodb=#\q
Voilà! A postGIS database called geodb
is available for user postgres
on port 5439