简体   繁体   中英

performance of pg_routing with exact location

pg_routing find shortest path from a start and an end point which are exacts vertexes on ways (the nodes), but there's no proper solution when we want to find the shortest path for locations which are not on the ways (like POI, exacts addresses, ...). The general solution is to search the nearest nodes, and then compute the shortest path, but the result can be far from the reality if for example, the road has a big length, or the nearest node is on another road which doesn't intersects the nearest road of the searched location. So, I think about 2 solutions for this problem but I don't really know how pg_routing algorithms are efficient if the network grow up : 1- split the road at each X meters, which will drastically increase the number of nodes, and BTW the topology, and then compute the shortest path on these new nodes, 2- At each pg_routing call, pre-compute for start/end locations : find the nearest way, split this way in 2 parts with ST_LineLocatePoint at the nearest location, append these news ways to the others no-splitted ways, and finally call pg_routing So, which is the best solution in term of performance, taking into account the fact that for solution 2, I don't know how to dynamically modify the topology?

Look at the WithPoints family of functions in 2.2 which will be going to alpha/beta very shortly. And pgr_trsp() already has that capability since 2.0 where you can route between locations defined by edge and percentage along that edge.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM