[pgrouting-dev] Building some tools to work with TSP
Stephen Woodbridge
woodbri at swoodbridge.com
Thu Dec 12 12:10:18 PST 2013
https://github.com/pgRouting/pgrouting/wiki/Working-with-OSM-Data
Please feel free to add to this if you have useful information on
working with OSM data.
Thanks,
-Steve
On 12/12/2013 2:49 PM, Stephen Woodbridge wrote:
> On 12/12/2013 2:07 PM, Helder Alves wrote:
>> I've already compiled that version... ;-)
>>
>> Can you please check the query below?
>>
>> select * from pgr_trsp(
>> 'select id, source, target, cost, reverse_cost from ways',
>> pgr_pointstovids(
>>
>>
>> pgr_texttopoints('-8.6406,40.65374;-8.6637,40.64008;-8.6923,40.63095;-8.7411,40.63105',
>> 4326),
>> 'ways'), -- array of vids
>> false, -- directed graph?
>> false -- has_reverse_cost?
>> );
>>
>> This is the result I get from the query:
>>
>> seq;id1;id2;cost
>> 1;-1;0;0
>> 2;-1;0;0
>> 3;-1;0;0
>>
>> If I run a standalone pointstovids query, these are the vids I get:
>> "{228347,228369,98306,146098}"
>
> So you are saying:
>
> select * from pgr_pointstovids(pgr_texttopoints(
> '-8.6406,40.65374;-8.6637,40.64008;-8.6923,40.63095;-8.7411,40.63105',
> 4326), 'ways');
>
> returns:
>
> {228347,228369,98306,146098}
>
> and:
>
> select * from pgr_trsp(
> 'select id, source, target, cost, reverse_cost from ways',
> '{228347,228369,98306,146098}'::integer[],
> false, false);
>
> is returning:
>
> seq;id1;id2;cost
> 1;-1;0;0
> 2;-1;0;0
> 3;-1;0;0
>
> Hmmm, what do you get with:
>
> select * from pgr_trsp(
> 'select id, source, target, cost, reverse_cost from ways',
> 228347, 228369, false, false);
>
> select * from pgr_trsp(
> 'select id, source, target, cost, reverse_cost from ways',
> 228369, 98306, false, false);
>
> select * from pgr_trsp(
> 'select id, source, target, cost, reverse_cost from ways',
> 98306, 146098, false, false);
>
>> I must tell you that the geometry between 228347 and 146098 is just fine
>> and routable, and to go from a vid to the other you have to go though
>> 228369 and 98306.
>
> Have you read and run these tools?
>
> http://imaptools.com:8081/pgr2-doc/2.0/en/doc/src/tutorial/analytics.html
> http://imaptools.com:8081/pgr2-doc/2.0/en/src/common/doc/functions/node_network.html
>
>
>> Do you have any idea of what is going on here?
>
> You have to break it down to simple queries to find the root cause of
> the problem.
>
> -Steve
>
>> Thanks! :-)
>>
>>
>> --
>> Helder Alves
>> +351912384076
>>
>>
>> On Thu, Dec 12, 2013 at 6:28 PM, Stephen Woodbridge
>> <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>> wrote:
>>
>> On 12/12/2013 12:49 PM, Helder Alves wrote:
>>
>> Hi Steve,
>>
>> Where did you put pgr_trsptsp in the source tree?
>>
>>
>> I don't think I did anything like that. IIRC, the discussion was to
>> use pgr_vidsToDMatrix() that uses kdijkstra to compute the distance
>> matrix, then use TSP to get the ordered list of points then call
>> trsp with an array of locations to get point to point routes with
>> via points. Read src/trsp/doc/index.rst in the develop branch.
>>
>> You might be thinking about:
>>
>> https://github.com/pgRouting/__pgrouting/tree/develop/src/__kdijkstra
>> <https://github.com/pgRouting/pgrouting/tree/develop/src/kdijkstra>
>>
>> Where I Added a new version of pgr_vidsToDMatrix written in C that
>> is 3X fast…
>>
>> -Steve
>>
>> I can't find it...
>>
>> Thanks!
>>
>> --
>> Helder Alves
>>
>>
>>
>> _________________________________________________
>> pgrouting-dev mailing list
>> pgrouting-dev at lists.osgeo.org
>> <mailto:pgrouting-dev at lists.osgeo.org>
>> http://lists.osgeo.org/__mailman/listinfo/pgrouting-dev
>> <http://lists.osgeo.org/mailman/listinfo/pgrouting-dev>
>>
>>
>> _________________________________________________
>> pgrouting-dev mailing list
>> pgrouting-dev at lists.osgeo.org <mailto:pgrouting-dev at lists.osgeo.org>
>> http://lists.osgeo.org/__mailman/listinfo/pgrouting-dev
>> <http://lists.osgeo.org/mailman/listinfo/pgrouting-dev>
>>
>>
>>
>>
>> _______________________________________________
>> pgrouting-dev mailing list
>> pgrouting-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/pgrouting-dev
>>
>
> _______________________________________________
> pgrouting-dev mailing list
> pgrouting-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-dev
More information about the pgrouting-dev
mailing list