2014年9月11日 星期四

Installing pgRouting on Windows 7



This quick guide outlines the steps I took to get Postgresql, PostGIS and pgRouting installed on Windows 7 Pro.


1. Install Postgresql


Download the installer from EnterpriseDB.com, double click to start the installer and accept most of the defaults except for the port to run the server on. I installed 9.0.13, 9.1.9 and 9.2.4 running each server on a different port. So 9.0.13 is running on 5432, 9.1.9 on 5433 and 9.2.4 on 5434.


The installers install the correct version of pgAdmin III for each version of the database and it is recommended to use the right pgAdmin III with the right Postgresql. This ensures database integrity and interactive functionality suitable for each version. For Postgresql 9.2 use pgAdmin 1.16.1, for Postgresql 9.1 use 1.14.3 and for Postgresql 9.0 use 1.12.3.


2. Install PostGIS


Download the installers from OSGEo.


For Postgresql 9.0 install http://download.osgeo.org/postgis/windows/pg90/postgis-pg90-setup-1.5.5-1.exe and select the correct instance of Postgresql on port 5432


For Postgresql 9.1 install http://download.osgeo.org/postgis/windows/pg91/postgis-pg91-setup-1.5.5-1.exe and select the correct instance of Postgresql on port 5433. I could have installed a later version of PostGIS on 9.1 but I needed 1.5.5 to work with AstunTechnology’s PortableGIS Loader! (Seearchaeogeek’s blog)


For Postgresql 9.2 install http://download.osgeo.org/postgis/windows/pg92/postgis-pg92-setup-2.0.3-2.exe and select the correct instance of Postgresql on port 5434


3. Install pgRouting


For the development versions of pgRouting visit Boston GIS and get 1.0.7dev for Windows 32-bit and PostgreSQL 9.2 (I am running 32-bit Windows). pgRouting contains the following features:
Dijkstra algorithm – Shortest path algorithm, which named in honor of Prof. Dr. Edsger Wybe Dijkstra who has invented it
A-star (A*) algorithm – Shortest path algorithm using heuristical function
Driving distance – area person can cover in certain time from start point using road network
TSP Travelling Salesman Problem solution
Shooting star (Shooting*) algorithm – Shortest path algorithm for real road networks with turn restrictions, traffic lights and one way streets.


To install and enable pgRouting (read the README) copy the contents of /lib (.dlls required for problem solving) and /share/extension (.sql files to enable pgrouting in the database) to the C:\Program Files\PostgreSQL\9.2\lib\ and C:\Program Files\PostgreSQL\9.2\share\extension folders respectively.


Then, using the psql prompt or pgAdmin III, do:CREATE EXTENSION pgrouting;



Now you should have a pgRouting-enabled PostGIS database.


There are older version of pgRouting available to download from Github. You’ll need to extract the zip archive and run the various SQL files to install the required routing functionality as well as copying the .DLL files to the correct folder as above. Boston GIS have also release dev versions of pgRouting 2.0.0 which I have not tried.

沒有留言:

張貼留言