Deploying PostGIS

Introduction

PostGIS is a set of geographical and spatial tools for Postgres DBMS, and it is normally installed as part of the Stack Builder at install. However, many systems come without the option to install Stack Builder, and a pre-installed postgres database may not have the necessary components. In this brief guide, i'll help you locate the necessary prerequisite packages and

Please note that this guide assumes that you will be installing PostGIS onto an existing install of Postgres running under Unix or another posix compliant system.

Dependencies

In order to install the PostGIS tools, you will first need to install Geos 3.1+ and Proj-4+. Both of these packages can be located via their webpages and provide both source and binaries for Debian, Fedora and SUSE.

I recommend using binaries and your favorite package manager to install the Geos and Proj packages. (example pending - yum geos & proj)

Installing PostGIS

The PostGIS package should be obtained and installed in a similar way. It can be obtained from http://www.postgis.org.

(example pending - yum postgis)

Creating a Database

PostGIS needs to be enabled on an individual database basis with specific scripts. These are included with the install of PostGIS and are located in the postgis/contrib directory (in my case, located in /usr/share/), and can be imported into an existing blank database via the command line. Additional scripts for adding tdar's GIS database are located in tdar's src/main/db/ directory. The following example assumes that we are using the 'tdargis' database, which should be owned by the tdar user. Note the explicit use of the Postgres user: these scripts alter system level data for the database in question, and must be executed by a superuser.

>psql -U postgres tdargis < /usr/share/postgis/contrib/postgis.sql

OR

>psql -U postgres tdargis < /usr/share/postgis/contrib/postgis-64.sql


>psql -U postgres tdargis < /usr/share/postgis/contrib/spatial-ref-sys.sql
>psql -U tdar tdargis < /tdar/src/main/db/tdargis.sql

 

(pending - relevant response text from install)