I have installed PostGIS thirty minutes ago, and it wasn't very easy, because the documentation is a few incomplete...

Before you begin to install PostGIS, you have to install and configure correctly PostgreSQL package. I have installed PostgreSQL-8.1.5.

First, you must install the libraries GEOS and Proj 4. Kubuntu 6.10 distribution has the GEOS' libraries, so you can get them with apt or kPackage.

The GEOS' libraries are:

  • libgeos-doc
  • libgeos-dev
  • libgeos2c2a
  • libgeos-c1
There is not Proj 4 library in Kubuntu 6.10 distribution, but you can download here.

After that, you have to uncompress the postgis-1.2.0 package into the directory contrib which is located in postgresql-version directory, where you have uncompress the postgresql package. For example, if you uncompress postgresql package in /tmp/postgresql-version, you have to copy postgis directory into /tmp/postgresql-version/contrib.

Next, you have to configure the Makefile before compiling:

$ ./configure --prefix=/usr --with-pgsql=/usr/local/pgsql/bin/pg_config --with-geos=/usr/bin/geos-config --with-proj=/usr

Now, you must compile:

$ make -D lwgeom

$ sudo make install

When you installed PostgreSQL, you had to create a new user, postgres, as instance. You can create a database with this user:

$ createdb -U postgres your_database

Finally, you have to configure PostGIS:

$ createlang -U postgres plpgsql your_database

$ psql -U postgres -d your_database -f /tmp/postgresql-version/contrib/postgis-1.2.0/lwpostgis.sql

$ psql -U postgres -d your_database -f /tmp/postgresql-version/contrib/postgis-1.2.0/spatial_ref_sys.sql

And that's all. If you want to restore sql tables (sql files), you must do this:

$ psql -U postgres -d your_database -f file.sql

I hope this post might be helpful :)


Hosted by www.Geocities.ws

1