Installing & Setting Up PostgreSQL With PostGIS
Author: Dan Blomberg | Last updated November 17th, 2013 at 04:01pm
This tutorial will guide you through the steps involved with installing PostgreSQL and PostGIS on your Windows based PC. PostGIS is a requirement for the way GPSFileDepot creates Garmin compatible maps.
This tutorial last updated for version 9.3.1 and postGIS 2.1.0.
- Go the the PostgreSQL windows downloads.
- Download the "one click installer".
- Click windows on the EnterpriseDB page and download the appropriate version for your computer (64bit or 32bit).
- Run the .exe that has been downloaded to install PostgreSQL.
- The default install directories should be good. When prompted enter a password that you can remember.
- The normal settings should be good.
- Make sure the "Launch Stack Builder at exist?" box is unchecked and click finish.
- Now we will make it so you can connect without a password (this is optional but makes life easier)
- Open pg_hba.conf in C:\Program Files\PostgreSQL\9.3\data with notepad or a similar document editor.
Change the line reading:
host all all 127.0.0.1/32 md5
host all all 127.0.0.1/32 trust
If you use IPv6 change the next line below it as well.
- Reload the configuration files (start>all programs>postgresql X.X>Reload configuration)
- Start the Application Stack Builder (in PostgreSQL's start menu)
Select your local server:
Under "Spatial Extensions" check the most recent version of PostGIS:
- Leave the download location alone and click "Next"
- After the download finishes click next to start installing.
- Make sure create spatial database is checked.
- Leave the default options. Make sure you enter your password if needed.
- Change the database name to postgis
Now you should have a fully operational postgis database.
Creating More Databases
You may, at some point, need to create more postGIS databases. In this case you need to create them with a template file.
- Open pgAdmin III
- Connect to your local server
- Right click on databases and click "New Database..."
- Enter a name for your new database
- Select the username you've been using as the owner (default is "postgres")
For the template select "template_postgis"
- Click okay.
A new database has now been created. You have to use a template in order to have it be a spatial database.