[pgrouting-users] ordering of route edges?
Stephen Woodbridge
woodbri at swoodbridge.com
Mon Nov 29 14:54:09 EST 2010
A more useful query would be:
SELECT gid, astext(the_geom) FROM dijkstra_sp_delta('roads',1,400,0.1)
Also in dijkstra you pass vertex nodes 1 and 400 BUT you get back edges
in the order of traversal. The tricky part is that the edge is return as
loaded and NOT as traversed, so you need to do some checking and flip
those segments that were traversed backwards from the disrtion that they
were loaded.
-Steve W
On 11/29/2010 1:46 PM, Madison Shaw wrote:
> Hi Daniel,
>
> Thanks for the quick reply, my SQL statement and its results are below
> (with pre selected start and finish points for ease of illustrating my
> issue)
>
> As you can see, the edge (gid) that we start from '1' is given the id of 29.
>
> SELECT gid, the_geom FROM dijkstra_sp_delta('roads',1,400,0.1)
>
> Results
>
> id; gid; the_geom
> 1;15;"0102 ... B40"
> 2;17;"0102 ... B40"
> 3;1139;"0102 ... B40"
> 4;746;"0102 ... B40"
> 5;879;"0102 ... B40"
> 6;12;"0102 ... B40"
> 7;1133;"0102 ... B40"
> 8;9283;"0102 ... B40"
> 9;7;"0102 ... B40"
> 10;1137;"0102 ... B40"
> 11;875;"0102 ... B40"
> 12;880;"0102 ... B40"
> 13;634;"0102 ... B40"
> 14;637;"0102 ... B40"
> 15;4;"0102 ... B40"
> 16;18;"0102 ... B40"
> 17;19;"0102 ... B40"
> 18;14;"0102 ... B40"
> 19;1143;"0102 ... B40"
> 20;1135;"0102 ... B40"
> 21;1259;"0102 ... B40"
> 22;109;"0102 ... B40"
> 23;1129;"0102 ... B40"
> 24;1136;"0102 ... B40"
> 25;1130;"0102 ... B40"
> 26;1131;"0102 ... B40"
> 27;1146;"0102 ... B40"
> 28;876;"0102 ... B40"
> 29;1;"0102 ... B40"
> 30;9;"0102 ... B40"
> 31;11;"0102 ... B40"
> 32;1132;"0102 ... B40"
> 33;8759;"0102 ... B40"
> 34;1138;"0102 ... B40"
> 35;1260;"0102 ... B40"
> 36;8;"0102 ... B40"
> 37;10;"0102 ... B40"
> 38;1128;"0102 ... B40"
> 39;1142;"0102 ... B40"
> 40;1134;"0102 ... B40"
> 41;1147;"0102 ... B40"
> 42;16;"0102 ... B40"
> 43;13;"0102 ... B40"
> 44;1140;"0102 ... B40"
> 45;1258;"0102 ... B40"
>
> Cheers
>
> Madison
>
>
>
> On 29 November 2010 18:30, Daniel Kastl<daniel at georepublic.de> wrote:
>> Hi Madison,
>> Could you send me your routing query to see how it looks like?
>> Daniel
>>
>> 2010/11/30 Madison Shaw<madisonshaw at googlemail.com>
>>>
>>> Hi There,
>>>
>>> I was wondering if someone could help me. I have pgrouting working
>>> and producing routes using both Dijkstra and AStar, but the edges that
>>> are returned by the SQL are in the wrong order... not the order of the
>>> edges as you expect to move through the route from start to finish...
>>>
>>> eg: (using a short example)
>>>
>>> If I have a route of ten edges, from start edge 1 to finish edge 10 -
>>> I would expect the results to be: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 (using
>>> the id column that is returned from the sql)
>>>
>>> However, the results are more like 3, 6, 2, 8, 1, 9, 4, 7, 10, 5.
>>>
>>> Is this supposed to happen? Is there a way to return the results in
>>> the order you traverse through the route?
>>>
>>> Cheers
>>>
>>> Madison
>>> _______________________________________________
>>> Pgrouting-users mailing list
>>> Pgrouting-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>>
>>
>>
>> --
>> Georepublic UG& Georepublic Japan
>> eMail: daniel.kastl at georepublic.de
>> Web: http://georepublic.de
>>
>> _______________________________________________
>> Pgrouting-users mailing list
>> Pgrouting-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>>
>>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
More information about the Pgrouting-users
mailing list