[R-sig-Geo] is there package can caculate shortest path with shp file in R?

Roger Bivand Roger.Bivand at nhh.no
Tue Mar 20 14:24:17 CET 2007


On Tue, 20 Mar 2007, StinJia wrote:

> hello,everyone!i want to build a webgis application on transport,using R
> as Spatial server,and is there any package can caculate shortest path
> with shp file in R?
> 

Not directly. How you develop this will depend on your shapefile. If you 
can get to a matrix of "distances", you can use allShortestPaths() and 
extractPath() in the e1071 package, see:

RSiteSearch("shortest path")

These use full matrices rather than sparse matrices, so for real-scale 
problems, it may not be all you need, but it is a start.

If the shapefile is a network, you'll need to find out how to get two 
pieces of information from it: which two nodes it links, and the 
"distance" it represents - these are two different kinds of information, 
and may take some work. There is a graph package in Bioconductor, but I'm 
not sure that it will help. There also seem to be functions in the sna 
package. However, none of them are directly relevant to arcs and nodes 
from shapefiles.

Roger

> StinJia
> 2007-03-20
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list