Note
For pgRouting version >= 1.0 RC1 (Previous versions cannot be compiled without TSP and Driving Distance functionality)
Compile and install PostgreSQL, PostGIS, Proj, GEOS, BGL and GAUL. Usually it is sufficient to run:
# ./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++
CGAL needs special treatment!
After you install CGAL, you need to locate the directory with CGAL header files. In that directory you need to find ‘’config’’ subdirectory. This directory contains one or more subdirectories with platform-dependent information.
It may look like this, for example:
/
|
+- usr
|
+- include
|
+- CGAL
|
+- config
|
+- i686_Linux-2.6_g++4.1.1
| |
| +- CGAL
| |
| +- compiler_config.h <<< this is the file you need
|
+- msvc7
| |
| +- CGAL
| |
| +- compiler_config.h
|
etc...
All you need to do is to choose ‘’compiler_config.h’’ for your platform and make a symlink or copy it to the main headers directory.
For example:
# ln -s /usr/include/CGAL/config/i686_Linux-2.6_g++4.1.1/compiler_config.h /usr/include/CGAL/compiler_config.h
cmake .
make
make install
# Add Traveling Salesperson functionality: -DWITH_TSP=ON
# Add Driving Distance functionality : -DWITH_DD=ON
cmake -DWITH_TSP=ON -DWITH_DD=ON .
make
make install
If your program compiles but you get an error like the following one:
error while loading shared libraries: libgaul.so.0: cannot open
shared object file: No such file or directory
Maybe you installed PostgreSQL from Source-code, while compiling pgRouting you might get an error like
Output directory for libraries is set to sh: pg_config: command not found
....
....
ERROR: could not access file "$libdir/librouting
Then you need to type at the shell-console:
export PATH="$PATH:/usr/local/pgsql/bin"
presuming you installed PostgreSQL at /usr/local/pgsql/bin
createdb -U postgres -E UNICODE routing
createlang -U postgres plpgsql routing
psql -U postgres -f /path/to/postgis/lwpostgis.sql routing
psql -U postgres -f /path/to/postgis/spatial_ref_sys.sql routing
psql -U postgres -f /usr/share/postlbs/routing_core.sql routing
psql -U postgres -f /usr/share/postlbs/routing_core_wrappers.sql routing
# With TSP
psql -U postgres -f /usr/share/postlbs/routing_tsp.sql routing
psql -U postgres -f /usr/share/postlbs/routing_tsp_wrappers.sql routing
# With Driving Distance
psql -U postgres -f /usr/share/postlbs/routing_dd.sql routing
psql -U postgres -f /usr/share/postlbs/routing_dd_wrappers.sql routing