GIS preconf code4libcon2009

From Code4Lib
Revision as of 22:01, 8 February 2009 by Bess (Talk | contribs) (I added installation docs for OSX)

Jump to: navigation, search

Open Source GIS Pre-conference at code4libcon 2009

Please try to install the software before the conference so we can have as much time as possible to actually play with GIS, and as little time as possible debugging installations. Here are Adam's original instructions (edited slightly so they format clearly on the wiki):

NB: Do not install this software as 'root'. It will not run as 'root' for security.

Download the source code

  1. wget http://aleph.lib.virginia.edu/providence/src.tgz
  2. Unpack the source: tar -xzvf src.tgz ; cd src

Install PostgreSQL 8.3.5

You can place PostgreSQL anywhere you like, but if at all possible, I strongly recommend using the default "/usr/local/pgsql". You may also put the PostgreSQL data directory where you choose.

  1. cd ~
  2. mkdir /usr/local/pgsql ; mkdir /usr/local/pgsql/data
  3. export PG_PREFIX=/usr/local/pgsql
  4. export PGDATA=/usr/local/pgsql/data
  5. Unpack source: tar -xzvf src.tgz ; cd src
  6. cd postgresql-8.3.5
  7. ./configure --prefix=$PG_PREFIX --with-libxml --with-libxslt --enable-thread-safety
  8. make ; make MAX_CONNECTIONS=10 check (MAX_CONNECTIONS avoids problems caused by limits in your OS on spawning new processes)
  9. make install

Install PROJ.4 4.6.0

  1. cd ../proj-4.6.0/
  2. ./configure --prefix=$PG_PREFIX
  3. make ; make check
  4. make install

Install GEOS 3.0.3

  1. cd ../geos-3.0.3
  2. ./configure --prefix=$PG_PREFIX
  3. make ; make check
  4. make install

Install PostGIS 1.3.5

  1. cd ../postgis-1.3.5
  2. ./configure --prefix=$PG_PREFIX --with-proj=$PG_PREFIX --with-pgsql=$PG_PREFIX/bin/pg_config --with-geos=$PG_PREFIX/bin/geos-config
  3. make
  4. make install

NB: PostGIS requires installation before running regression checks, because it's just a library of functions for PostgreSQL.

Put it all together

  1. Add our new commands to the execution path: export PATH=$PG_PREFIX/bin:$PATH
  2. initialize a database directory in $PGDATA, with a default character encoding of UTF-8 and a root db user with the same name as our login name: initdb -U `whoami` -E UTF-8 -W
  3. start the database: pg_ctl -l $PGDATA/log start
  4. make check
  5. pg_ctl stop

OSX 10.5.6 installation

Notes by Bess Sadler, feel free to email me with questions: bess [at] virginia [dot] edu

I tried to use Adam's directions and to compile postgres from source, but I wasn't able to do so. I kept encountering this error:

tab-complete.c:2103: warning: assignment makes pointer from integer without a cast
make[3]: *** [tab-complete.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

Instead, I used macports. It seemed to work quite well, but I haven't been able to test it with actual GIS data yet, so I'll update this as soon as I do. Here's my installation procedure:

  1. Install macports
  2. Add /opt/local/bin to /etc/paths
  3. sudo port install postgresql83-server postgresql83 postgresql83-doc
  4. Add /opt/local/lib/postgresql83/bin to /etc/paths
  5. sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist (this command was listed in the post-installation messages for postgres, and it makes postgres start on boot)
  6. sudo port install proj @4.6.1
  7. sudo port install geos
  8. However, I did install postgis from source, because the latest rev wasn't available as a package:
  ./configure --prefix=/usr/local/postgis-1.3.5 --with-proj=/opt/local --with-pgsql=/opt/local/lib/postgresql83/bin/pg_config --with-geos=/opt/local/bin/geos-config
  make
  sudo make install
  1. Add /usr/local/postgis-1.3.5/bin to /etc/paths
  2. initialize a database directory in $PGDATA, with a default character encoding of UTF-8 and a root db user with the same name as our login name (I just specified the root user id, since I wasn't sure what value `whoami` would return if the command was being run by root su-ing to the postgres user: sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -U eos8d -E UTF-8 -W -D /usr/local/pgsql/data'
  3. Start that database: sudo su postgres -c '/opt/local/lib/postgresql83/bin/pg_ctl -D /usr/local/pgsql/data start'
  4. Run tests in postgis src directory: make check" My output looked like this:
paz:postgis-1.3.5 eos8d$ make check
make -C regress test
Creating spatial db postgis_reg 
TMPDIR is /var/folders/BP/BPimaox+FGSt3VG99a3f9++++TQ/-Tmp-/

 PostgreSQL 8.3.6 on i386-apple-darwin9.6.0, compiled by GCC i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
 Postgis 1.3.5 - 2009-02-08 21:15:08
   GEOS: 3.0.3-CAPI-1.4.2
   PROJ: Rel. 4.6.1, 21 August 2008

Running tests

 loader/Point.............. ok
 loader/PointM.............. ok
 loader/PointZ.............. ok
 loader/MultiPoint.............. ok
 loader/MultiPointM.............. ok
 loader/MultiPointZ.............. ok
 loader/Arc.............. ok
 loader/ArcM.............. ok
 loader/ArcZ.......... ok
 loader/Polygon.............. ok
 loader/PolygonM.............. ok
 loader/PolygonZ.............. ok
 regress. ok
 regress_index. ok
 regress_index_nulls. ok
 lwgeom_regress. ok
 regress_lrs. ok
 removepoint. ok
 setpoint. ok
 simplify. ok
 snaptogrid. ok
 affine. ok
 wkt. ok
 measures. ok
 long_xact. ok
 ctors. ok
 sql-mm-serialize. ok
 sql-mm-circularstring. ok
 sql-mm-compoundcurve. ok
 sql-mm-curvepoly. ok
 sql-mm-general. ok
 sql-mm-multicurve. ok
 sql-mm-multisurface. ok
 geojson. ok
 regress_ogc. ok
 regress_bdpoly. ok
 regress_ogc_cover. ok
 regress_proj. ok
 kml. ok

Run tests: 39
Failed: 0

So it looks like everything worked, but I'll let the group know and update this page if I find out otherwise.