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 am working for a project. I have a road network which has been imported in PostgreSQL/PostGIS database. I can query shortest path between two points. I want to get route plan with certain distance. Suppose, I want to go from point A to point B. There may have different way to go from point A to B. But, I want to fix the length, suppose, 10 km. That means, I want to know the route plan to go from point A to point B but in 10 km range. Is it possible to get this kind of query using pgRouting? Or I should use any other tools? If it is possible how should I write the query?

Note: in my database table 'route', i have 'gid', 'source', 'target', 'cost' etc columns.

Thanks, in advance.

share|improve this question
up vote 0 down vote accepted

No, I don't think pgRouting can do this. Shortest path algorithms minimize costs. If you want a fix length there would be too many possibilities.

K-shortest path is an algorithm that returns alternative routes (someone is currently working on an implementation as far as I know). But this still wouldn't allow you define the length.

share|improve this answer
I agree, and there may not even be any routes at exactly 10 km length. – Uffe Kousgaard Apr 5 '12 at 6:14

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.