Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use pgRouting for showing shortest path on hiking trails. I created web map so I need to enable users when they click on start and end point somewhere on hiking trails, that it shows shortest path between those two points. I am beginner with it, so I just need to tell me where to start. I have those lines in postgis database and I am working with phpPgAdmin and Mapserver.

share|improve this question
This question is much too broad. You should try some books on web mapping, first. – Sean Jun 15 '11 at 13:00
I developed web map which need to have this shortest path function. I don't think it is too broad. I just want you to tell me how to start. I am beginner with pgRouting, not with web mapping. – againstflow Jun 15 '11 at 13:03
up vote 3 down vote accepted

First you'll need to get pgRouting running. For a tutorial check: A Beginner’s Guide to pgRouting.

The simplest approach is to do node-to-node routing using shortest_path().

You'll need to enable the user to pick start and end node for their routings. For example code check: Picking a Feature’s Attribute Value From a WMS Layer With OpenLayers

In Mapscript, you can then tie a "Get Routing" button to a function that loads a new layer based on the shortest_path() query.


This is a great tutorial for creating a webmap with routing functionality: It is based on OpenLayers with GeoExt and pgRouting, but it's easy to adjust it to any other routing webservice.

share|improve this answer
UGh, our IT just blocked, can you provide a direct link so I can wget it perhaps? – dassouki Jun 15 '11 at 13:45
@dassouki use Google Translate then hit the Orginal option (top right corner)… too work around your IT url blocker... – Mapperz Jun 15 '11 at 13:58
@Mapperz - Still Blocked – dassouki Jun 15 '11 at 14:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.