GPSFileDepot
GPSFileDepot   XML/RSS Feeds

Installing & Setting Up PostgreSQL With PostGIS

Last updated June 15th, 2008 at 11:50am

Introduction

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.

Instructions

PostgreSQL

  1. Go the the PostgreSQL binary server.
  2. Click "latest"
  3. Click "win32"
  4. Download postgresql-X.X.X-X.zip. Where the X are the most recent version information.  Make sure you are getting at least version 8.3+.
  5. Select one of the mirrors and download via http or ftp.
  6. Save the zip file.
  7. Extract everything in the zip file to a folder.
  8. Double click "postgresql-X.X.msi"
  9. Select your language and hit next.
  10. The normal settings should be good.  Make sure you will have the Application Stack Builder installed.  Also, it is good to make sure pgAdmin III is installed.
  11. Make sure the "Install As Service" box is checked. (changed 19 Aug 08)
  12. Make sure the "Launch Stack Builder" box is unchecked and click finish.
  13. Now we will make it so you can connect without a password (this is option)
  14. Open pg_hba.conf (start>all programs>postgresql X.X>Configurations Files>Edit pg_hba.conf
  15. Change the line reading:
    host    all         all         127.0.0.1/32          md5
    to
    host    all         all         127.0.0.1/32          trust
  16. Reload the configuration files (start>all programs>postgresql X.X>Reload configuration)
  17. Start the service (start>all programs>postgresql X.X>Start Service)

PostGIS

  1. Now that the Application Stack Builder has launched you can install PostGIS.
    Note: If it didn't launch go to Start>All Programs>PostgreSQL X.X and click Application Stack Builder.  This is also how you can update PostGIS when new versions are released.
  2.  Select your local server:
  3. Under "Spatial Extensions" check the most recent version of PostGIS:
  4. Pick a server near you and click "Next"
  5. Make sure create spatial database is checked.
  6. Leave the default options.  Make sure you enter your password if needed.

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.

  1. Open pgAdmin III
  2. Connect to your local server
  3. Right click on databases and click "New Database..."
  4. Enter a name for your new database
  5. Select the username you've been using as the owner (default is "postgres")
  6. For the template select "template_postgis"
  7. Click okay.

A new database has now been created.  You have to use a template in order to have it be a spatial database.

If you have any questions about this tutorial please contact us or post in the forums.