Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

It's been a while we are using PostGIS to store our Geometry information in our Postgres database. We have developed vertex-to-vertex routing ourselves using iGraph library. Yesterday I read about pgRouting and I am porting our current application to pgRouting. However, I face some issues in using shooting start path finder.

We stored edges and vertices information in tables and for finding a graph route with turn restriction, we are calling following SQL script:

SELECT  shortest_path_shooting_star(
                e.first as source,
                e.second as target,
                ST_Length(e.geom) as cost, 
                st_x(st_pointn(e.geom, 1)) AS x1, st_y(st_pointn(e.geom, 1)) AS y1,
                st_x(st_pointn(e.geom, 2)) AS x2, st_y(st_pointn(e.geom, 2)) AS y2,
                (not connected)::boolean::int * 1000000 AS to_cost,
                c.first AS rule
        FROM edges e LEFT OUTER JOIN edge_connections c ON = c.second
        WHERE e.group_id = 0
        ORDER BY',
    1209560, 1209653, true, false);

My inner subqery woud have following results:

  id    | source  | target  |   cost |  x1   |  y1   |  x2   |  y2   | to_cost |  rule  
1087134 |  926686 |  926687| 2.3299 |51.4675|35.728 |51.4675|35.7280|         |    
1209706 | 1039731 | 1039870 | 4.005 |51.4082|35.7239|51.4082|35.7239| 1000000 | 1209564

In the results, when a constraint exists, rule and to_cost would not be NULL. When a turn restriction exists, the results would be exactly like what specified in the docs.

However, when I call the shortest_path_shooting_star function, results would not differ if a rule-and-to_cost exists or not. I have changed directed and has_reverse_cost parameters but nothing happened.

I was wondering if you guys could help me in this matter. Any advice or even a clue would be very much appreciated. Thanks, * Roozbeh

share|improve this question

You seem to be lacking the "reverse_cost" column in your subquery.

From docs:

reverse_cost (optional): the cost for the reverse traversal of the edge. This is only used when the directed and has_reverse_cost parameters are true (see the above remark about negative costs).

share|improve this answer

Your Answer


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