[postgis-users] Calculate driving distance in postgis
Arnaud Lesauvage
thewild at freesurf.fr
Thu Feb 2 00:58:39 PST 2006
K Kuo a écrit :
> I have a database which convert from tiger/line data. I have found that I
> can use distance_spheroid function to calculate distance between two points,
> which supposes to be the shortest distance instead of driving distance, am I
> correct? What I am thinking about is that I have to query out all nodes
> alone the route, calculate distances for each segment then add them up. I
> don't think this is a good approach. Any suggestion?
Hi !
I have successfully installed and used pgdijkstra, which is a
PostgreSQL implementation of the Dijkstra algorithm (widely used
for shortest path calculations).
http://www.cartoweb.org/contribs.html
It is very easy to install and fairly easy to use.
This module includes special PostGIS functions that can return the
shortest path between two nodes as a PostGIS geometry (a
LINESTRING, I believe).
You would just need to get the Length() of this geometry to have
the exact driving distance between the nodes.
Regards
--
Arnaud
More information about the postgis-users
mailing list