I am trying to calculate the shortest path's distance from certain locations to their closest schools, I used the Pgr_WithPointsCost Function to get the result from one location to its 10 closest destinations (One to Many), But I can't use the (many to many) scripts since Pgr_WithPointsCost will calculate the shortest distance between every point of the source and every target point. The problem is my data set is huge and when I launch the script it crashes.

This is the script I used to calculate the distance

enter image description here


There is a handy function currently in pgRouting's develop branch coined dijkstraNear. This will help you compute many to many.

pgr_dijkstraNear(Edges SQL, Start vids, End vids [, directed] [, cap], [global])
RETURNS SET OF (seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.