Steve,<div><br></div><div>This is my route:</div><div><br></div><div><a href="http://cl.ly/2v3G05442o3h2H0G2L0l">http://cl.ly/2v3G05442o3h2H0G2L0l</a></div><div><br></div><div>i have restricted turn going from 9151, 9082.</div>
<div><br></div><div>how i need to set this in my table restricctions.</div><div><br></div><div>SQL:</div><div><br></div><div><div>drop table if exists routing.route;</div><div>create table if not exists routing.route(</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>nid serial not null</div><div>) with oids;</div><div>Select AddGeometryColumn(&#39;routing&#39;, &#39;route&#39;, &#39;geometry&#39;, &#39;4326&#39;, &#39;LINESTRING&#39;, 2);</div>
<div><br></div><div>insert into routing.route(geometry)</div><div>SELECT</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>routing.network.geometry</div><div>FROM</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>(</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>SELECT </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>*</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>FROM</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>turn_restrict_shortest_path(</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>&#39;SELECT </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.network.segment as id,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.network.source,</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.network.target,</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.network.length as cost,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.network.reverse_length as reverse_cost</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>FROM </div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.network&#39;,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>-- node_from, node_to</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>9151, </div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>9082, </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>--15242,</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>false, -- directed </div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>true, -- reverse_cost</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>&#39;SELECT</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.restrictions.target_id,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.restrictions.to_cost,</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.restrictions.via_path</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>FROM</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>routing.restrictions&#39;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>) as route inner join routing.network on</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>route.edge_id = routing.network.segment</div><div>;</div></div><div><br></div><div>Table looks like:</div><div>target_id   to_cost   via_path</div><div><div>
9082<span class="Apple-tab-span" style="white-space:pre">        </span>       1000<span class="Apple-tab-span" style="white-space:pre">        </span>     9151, 9083</div></div><div><br></div><div>i missing somehting?</div><div><br><br>
<div class="gmail_quote">2012/1/30 Stephen Woodbridge <span dir="ltr">&lt;<a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 1/30/2012 4:20 PM, Stephen Woodbridge wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The turn restrictions are handled differently in TRSP. You need to have<br>
a table like:<br>
<br>
target_edge_id (int4), to_cost(float8), via_path (text)<br>
<br>
This is a replacement for the rule and at the moment<br>
via_path := reverse(rule)<br>
<br>
so if your rule = 1,2,3,4 then via_path = 4,3,2,1<br>
I think that this will eventually change to be consistent with<br>
shooting_star and the rule.<br>
<br>
I believe that the way to interpret this is to apply the to_cost if the<br>
current edge it target_edge_id and prior edge was 4, and 3 before that,<br>
and 2 before that, and 1 before that. So the cost would NOT be applied<br>
given this rule if the path was current_edge, 4, 3, 7 for example.<br>
<br>
You may have multiple rules for a given target_edge_id.<br>
</blockquote>
<br>
In my database, I have a table like this:<br>
<br>
CREATE TABLE trsp_rest<br>
(<br>
  to_cost double precision,<br>
  target_id integer,<br>
  via_path text,<br>
  the_geom geometry,<br>
  &quot;rule&quot; text,<br>
  CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),<br>
  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = &#39;LINESTRING&#39;::text OR the_geom IS NULL),<br>
  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 4326)<br>
)<br>
WITH (<br>
  OIDS=FALSE<br>
);<br>
<br>
the geometry is just a copy of the target_id geometry that I can use to spatially restrict the restrictions to that of my query, but it is not required. You could also use a join to do the same thing.<br>
<br>
And then for the turn_restrict_sql you can pass something like:<br>
<br>
&#39;select to_cost, target_id, via_path from trsp_rest&#39;<br>
<br>
&#39;select to_cost, target_id, via_path from trsp_rest<br>
  where the_geom &amp;&amp; &lt;bbox of query&gt;&#39;<br>
<br>
-Steve<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-Steve<br>
<br>
On 1/30/2012 4:00 PM, Jorge Eliécer Osorio Caro wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Steve,<br>
<br>
I compile that version but i dont know very well the params that i need<br>
to send to:<br>
<br>
now we have via_path, means that edges where i can have access? its in<br>
replacement of rule?<br>
now we have that parameter to:<br>
<br>
sql text,<br>
<br>
source_id integer,<br>
<br>
target_id integer,<br>
<br>
directed boolean,<br>
<br>
has_reverse_cost boolean,<br>
<br>
turn_restrict_sql text)<br>
<br>
<br>
turn_restrict_sql what i need to pass there?<br>
<br>
i have something like this:<br>
<br>
SELECT * FROM turn_restrict_shortest_path( &#39;SELECT<br>
routing.network.segment as id, routing.network.source,<br>
routing.network.target, routing.network.length as cost,<br>
routing.network.reverse_length as reverse_cost, routing.network.x1,<br>
routing.network.y1, routing.network.x2, routing.network.y2,<br>
routing.network.rule as via_path, routing.network.to_cost FROM<br>
routing.network&#39;, -- node_from, node_to 15365, 15366, --15242, false, --<br>
directed true, -- reverse_cost &#39;ż?&#39; )<br>
<br>
thanks steve.<br>
<br>
<br>
<br>
<br>
<br>
<br>
2012/1/30 Stephen Woodbridge &lt;<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a><br>
&lt;mailto:<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.<u></u>com</a>&gt;&gt;<br>
<br>
Jorge,<br>
<br>
I have posted a few times on this problem, you can check the<br>
archives. The short story is the shooting star is broken. I think<br>
the last version that worked is 1.03. In my posts is also some<br>
information on a new algorithm turn_restricted_shortest_path (trsp)<br>
that is in a branch. The current code in a git branch works but is<br>
likely to see changes before it is released, but we do not have a<br>
release plan yet.<br>
<br>
-Steve<br>
<br>
On 1/30/2012 2:30 PM, Jorge Eliécer Osorio Caro wrote:<br>
<br>
Im having a issue when try to calculate the shortest path using turn<br>
restricctions this functions ignores the reverse_cost param.<br>
<br>
here the SQL:<br>
<br>
|SELECT<br>
<br>
*<br>
<br>
FROM<br>
<br>
shortest_path_shooting_star(<br>
<br>
&#39;SELECT<br>
<br>
<br>
routing.network.segment as id,<br>
routing.network.source,<br>
routing.network.target,<br>
routing.network.length as cost,<br>
routing.network.reverse_length as reverse_cost,<br>
<br>
<br>
routing.network.x1,<br>
routing.network.y1,<br>
routing.network.x2,<br>
routing.network.y2,<br>
<br>
routing.network.rule,<br>
routing.network.to_cost<br>
<br>
<br>
FROM<br>
routing.network&#39;,<br>
<br>
<br>
-- node_from, node_to<br>
<br>
15365,<br>
<br>
15366,<br>
<br>
--15242,<br>
<br>
<br>
false, -- directed<br>
<br>
true-- reverse_cost<br>
<br>
)<br>
<br>
|<br>
<br>
this generate that route:<br>
<br>
<a href="http://cl.ly/" target="_blank">http://cl.ly/</a> 242E2T0A2C410F1S0F3g<br>
&lt;<a href="http://cl.ly/242E2T0A2C410F1S0F3g" target="_blank">http://cl.ly/<u></u>242E2T0A2C410F1S0F3g</a>&gt;<br>
<br>
that method generate the route but it ignores the one_way<br>
restriction ,<br>
the restriction is ok, but take a route where ignores that.<br>
<br>
now in the next image i need the marked red lines are the<br>
correct route<br>
because the 15229 and 15228 has both ways.<br>
<br>
<a href="http://cl.ly/" target="_blank">http://cl.ly/</a> 3t2O38343F0F0C0o3P2c<br>
&lt;<a href="http://cl.ly/3t2O38343F0F0C0o3P2c" target="_blank">http://cl.ly/<u></u>3t2O38343F0F0C0o3P2c</a>&gt;<br>
<br>
here how look my table:<br>
<br>
id source target cost reverse:cost rule to_cost x1, y1, x2, y2<br>
15245 9082 9150 0.02 100.00021 15214 101.00021 -74.79981 10.94605<br>
-74.7996 10.94605<br>
<br>
how i cant fix that i compiled the last version of pgrouting<br>
from git repo.<br>
<br>
<br>
<br>
______________________________ _________________<br>
Pgrouting-users mailing list<br>
Pgrouting-users@lists.osgeo. org<br>
&lt;mailto:<a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.<u></u>osgeo.org</a>&gt;<br>
<a href="http://lists.osgeo.org/" target="_blank">http://lists.osgeo.org/</a> mailman/listinfo/pgrouting- users<br>
&lt;<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a>&gt;<br>
<br>
<br>
______________________________ _________________<br>
Pgrouting-users mailing list<br>
Pgrouting-users@lists.osgeo. org<br>
&lt;mailto:<a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.<u></u>osgeo.org</a>&gt;<br>
<a href="http://lists.osgeo.org/" target="_blank">http://lists.osgeo.org/</a> mailman/listinfo/pgrouting- users<br>
&lt;<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a>&gt;<br>
<br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.<u></u>org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a><br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.<u></u>org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a><br>
</blockquote></div><br></div>