0.x/InstallationManual

Installation Manual

Step 1: Libraries installation

Compile and install PostgreSQL, PostGIS, Proj, GEOS, BGL and GAUL. Usually it is enough to execute:

# ./configure 
# make 
# make install

in corresponding directory.

If you have BGL installed but the version is less than 1.33.0, just download the astar.hpp file from  http://www.boost.org/boost/graph/astar_search.hpp and copy it to BOOST_PATH/graph directory.

The GAUL library should be compiled with --enable-slang=no option. Otherwise make sure you have slang.h installed in /usr/include. For more details please refer to corresponding README or INSTALL file.

# ./configure --disable-slang

For CGAL, the compile option below can be used to create the library:

# ./install_cgal --prefix=/usr --with-boost=n --without-autofind -ni /usr/bin/g++

Step 2: Compiling the pgRouting library

In case there are 2 versions of PostgreSQL residing in the computer (for example a 7.4 and a 8.1 PostgreSQL), be sure that the target PostgreSQL's pg_config is in the PATH environment.

To build pgRouting, running "configure" first will usually suffice. If the BOOST, GAUL and CGAL libraries are not in the default paths, it will be necessary to tell configure where they can be located. Typing "./configure --help" will list the configure options.

# ./configure --with-cgal=/usr/local/CGAL --with-gaul=/usr/local
# make install

Step 3: Database Set Up

(Example: sample application)

To create example routing database do the following:

# PGSQL_PATH/bin/createdb -E UTF-8 routing
# PGSQL_PATH/bin/createlang plpgsql routing
# PGSQL_PATH/bin/psql -f PGSQL_PATH/share/contrib/lwpostgis.sql routing
# PGSQL_PATH/bin/psql -f PGSQL_PATH/share/contrib/spatial_ref_sys.sql routing
# PGSQL_PATH/bin/shp2pgsql -D kanagawa.shp kanagawa > kanagawa.sql
# PGSQL_PATH/bin/psql -f kanagawa.sql routing

To improve execution speed, create some indices for kanagawa table.

# create index gid_idx on kanagawa(gid);
# create index source_idx on kanagawa(source);
# create index target_idx on kanagawa(target);
# create index geom_idx on kanagawa using GIST (the_geom GIST_GEOMETRY_OPS);

Execute the sql file routing.sql to install the functions in your database

# PGSQL_PATH/bin/psql -f routing.sql routing

Execute routing_postgis.sql which will create PostGIS import and manipulation functions.

# PGSQL_PATH/bin/psql -f routing_postgis.sql routing