[pgrouting-users] Get the edges in correct order

ancaag04 at alumnos.unex.es ancaag04 at alumnos.unex.es
Mon Sep 12 23:34:49 EDT 2011


I've been doing more tests.

Everything is fine when using core functions, but the error occur if used wrapper
functions or subqueries  (like "Advanced Routing Queries - Weighted costs" in
FOSSG2010 workshop):


SELECT rt.edge_id AS gid, AsText(ways.the_geom) AS the_geom
		FROM ways, (
		SELECT * FROM shortest_path_astar('
			SELECT gid as id,
				class_id,
                        	source,
                        	target,
                        	length*c.cost as cost,
                        	x1, y1, x2, y2,
                        	reverse_cost*c.cost as reverse_cost
			FROM ways w, classes c
			WHERE class_id=c.id',
			50,26, false, false)
		) as rt
		WHERE ways.gid=rt.edge_id;




Maybe this is not a bug in pgRouting...
This could be caused by PosgreSQL (automatically "order by" when the number of
columns is greater than "..." rows).


thanks

-Antonio


> A bunch of us will be away at the FOSS4G conference in Denver this week,
> so you might not get a quick answer to this. I think it might be
> appropriate to write up a bug report in the ticket system and copy the
> appropriate details of the problem from the emails.
>
> If we have time to look into it we will post a response, but more likely
> it will need to wait until next week when people are back and have time
> to review the problem.
>
> Thanks,
>    -Steve
>
> On 9/11/2011 11:20 PM, ancaag04 at alumnos.unex.es wrote:
>> I found that the failure depends on the size of the imported topology.
>>
>> For example, if the database has 2000 or 1800 edges (or less), the order is
>> correct.
>> But if the database has 4000 or 6000 edges (or more), the order is wrong (is
>> ordered
>> automatically by gid).
>>
>> I do not know why this happens... I have not modified any function.
>>
>> -Antonio
>>
>>
>>
>>
>>> Hi Antonio,
>>>
>>> I'm not sure, but I did notice that your list of segments appears to be
>>> ordered by gid. You might want to check if the function shootingstar_sp
>>> has been modified and someone who added an "order by gid" clause to it.
>>>
>>> -Steve
>>>
>>> On 9/7/2011 11:35 PM, ancaag04 at alumnos.unex.es wrote:
>>>> Hello Steve, I know the discussion, but the problem is different.
>>>> For example, this image [1] shows a part of the city. I have marked the start
>>>> and
>>>> end edges.
>>>>
>>>> Now I have this query:
>>>>
>>>> SELECT gid, AsText(the_geom) AS the_geom
>>>>           FROM shootingstar_sp('ways', 552, 1096, 0.1, 'length', true, true);
>>>>
>>>>
>>>> This image [2] shows the results.
>>>>
>>>> [1] http://img828.imageshack.us/img828/7915/segments.png
>>>> [2] http://img215.imageshack.us/img215/5103/resultsi.png
>>>>
>>>>
>>>> I'm doing something wrong?
>>>> Thank you.
>>>>
>>>> --
>>>> Antonio
>>>>
>>>>
>>>>
>>>>> On 8/31/2011 11:28 PM, ancaag04 at alumnos.unex.es wrote:
>>>>>> Hello, i'm using A-star like this:
>>>>>>
>>>>>> SELECT gid, AsText(the_geom) AS the_geom
>>>>>> FROM astar_sp_delta('ways', 2124, 2168, 0.1);
>>>>>>
>>>>>> The path is correct but sometimes I don't get the edges in the correct order.
>>>>>> Is this normal?
>>>>>
>>>>> I think the edges are always in the correct order, but some times the
>>>>> edge is reversed from the direction that you traverse it on the route.
>>>>> This has been discussed in the past and I have posted an algorithm to
>>>>> correct that, but I do not have a link to it handy.
>>>>>
>>>>> -Steve
>>>>> _______________________________________________
>>>>> 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
>>>
>>> _______________________________________________
>>> 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
>
> _______________________________________________
> 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