TransWikia.com

How to use pg_routing to connect a point to the closest point of a set of points?

Geographic Information Systems Asked by Jorge Calvar on October 30, 2020

Imagine we have the location of a person (point) and 100 restaurants (each is a point). My objective is to calculate the path from the person to the nearest restaurant (just one), but I want to avoid calculating 100 shortest paths (which is what pgr_dijkstra one-to-many does), because it is time consuming.

Logically, this should be possible, as Dijkstra’s algorithm analyzes cost cumulatively. Therefore, if the algorithm has already reached the first restaurant and the cost is 50, then all paths whose cost is higher than 50 could be dropped.

How can I implement this in postgres, preferably using pg_routing?

Thank you for your help!

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP