[postgis-users] Calculate driving distance in postgis

Norman Vine nhv at cape.com
Thu Feb 2 13:58:26 PST 2006


Stephen Woodbridge writes:
> 
> If you already know what segments in the database the route will follow 
> then the length of the route can be calculated like
> 
> select sum(length_spheroid(the_geom, 
> 'SPHEROID["GRS_1980",6378137,298.257222101]') from your_table where 
> <select the segments in the route>
> 
> You can get fancier if you want to compute drive time along the route 
> based on CFCC road class by multiplying an average speed associated to 
> the CFCC of the segment and the length of the segment and summing up that.

And of course this can be done for all road segments off line ahead
of time and stored as another field in the DB

Then it is just a simple sum of the time fields of the segments of the route

Norman 



More information about the postgis-users mailing list