Utilizando Debian Lenny y teniendo ya instalados postgresql-8.3 + postgis voy a instalar la libreria pgRouting para el calculo de rutas.
Antes de instalar pgrouting, hay que instalar las siguientes librerias:
Boost
$ wget http://fastbull.dl.sourceforge.net/sourceforge/boost/boost_1_36_0.tar.gz
$ tar zxvf boost_1_36_0.tar.gz
$ cd boost_1_36_0/
$ ./configure
$ make
# make installPara corregir un error con la version de pgrouting que voy a utilizar creo este enlace simbólico:
# ln -s /usr/local/include/boost-1_36/ /usr/local/include/boost-1_35/CGAL
$ wget ftp://ftp.mpi-sb.mpg.de/pub/outgoing/CGAL/CGAL-3.3.1.tar.gz
$ tar zxvf CGAL-3.3.1.tar.gz
$ cd CGAL-3.3.1
# ./install_cgal --prefix=/usr/local --with-boost=n --BOOST_INCL_DIR /usr/local/include/boost-1_36 --BOOST_LIB_DIR /usr/local/lib --without-autofind -ni /usr/bin/g++GAUL
$ wget http://prdownloads.sourceforge.net/gaul/gaul-devel-0.1849-0.tar.gz?download
$ tar zxvf gaul-devel-0.1849-0.tar.gz
$ cd gaul-devel-0.1849-0/
$ ./configure --enable-slang=no
$ make
# make installInstalar PgRouting
Es necesario instalar cmake
# apt-get install cmakeDescargo pgrouting, compilo e instalo:
$ wget http://files.postlbs.org/pgrouting/source/pgRouting-1.03.tgz
$ tar zxvf pgRouting-1.03.tgz
$ cd pgrouting/
$ cmake -DWITH_TSP=ON -DWITH_DD=ON .
$ make
# make install
[ 16%] Built target routing_tsp
[ 50%] Built target routing_dd
[100%] Built target routing
Install the project...
-- Install configuration: ""
-- Installing: /usr/lib/postgresql/8.3/lib/librouting.so
-- Installing: /usr/share/postlbs/routing_core.sql
-- Installing: /usr/share/postlbs/routing_core_wrappers.sql
-- Installing: /usr/share/postlbs/routing_topology.sql
-- Installing: /usr/lib/postgresql/8.3/lib/librouting_tsp.so
-- Installing: /usr/share/postlbs/routing_tsp.sql
-- Installing: /usr/share/postlbs/routing_tsp_wrappers.sql
-- Installing: /usr/lib/postgresql/8.3/lib/librouting_dd.so
-- Installing: /usr/share/postlbs/routing_dd.sql
-- Installing: /usr/share/postlbs/routing_dd_wrappers.sqlPor último y como root hacer un ldconfig para reactualizar las bibliotecas.
Crear funciones en la BD
Por último a la base de datos que creamos para postgis, le añadimos las funciones pgRouting, TSP y Driving Distance
# su - postgres
$ psql mygisdb -f /usr/share/postlbs/routing_core.sql
$ psql mygisdb -f /usr/share/postlbs/routing_core_wrappers.sql
$ psql mygisdb -f /usr/share/postlbs/routing_topology.sql
$ psql mygisdb -f /usr/share/postlbs/routing_tsp.sql
$ psql mygisdb -f /usr/share/postlbs/routing_tsp_wrappers.sql
$ psql mygisdb -f /usr/share/postlbs/routing_dd.sql
$ psql mygisdb -f /usr/share/postlbs/routing_dd_wrappers.sqlDocumentación:
http://pgrouting.postlbs.org/wiki/1.x/InstallationUbuntu804
http://gaul.sourceforge.net/
http://www.cgal.org/
http://pgrouting.postlbs.org/wiki/1.x/MakeDebPackage