[R-sig-Geo] input shapefile to build graph-using R
silverlining
panpan.2010 at qq.com
Mon Feb 2 09:32:18 CET 2015
> # Load libraries
> library(spdep)
> library(igraph)
> library(maptools)
> pl <- readShapeLines("H:/data/Beijing_NatrualRoads.shp",
+ proj4string=CRS("+proj=Mercator_Auxiliary_Sphere +datum=WGS84"))
> pt <- readShapePoints("H:/data/Beijing_NatrualRoads_computejunctions.shp",
+ proj4string=CRS("+proj=Mercator_Auxiliary_Sphere +datum=WGS84"))
> g <- graph.data.frame(pl, directed=TRUE, vertices=pt)
Error in graph.data.frame(pl, directed = TRUE, vertices = pt) :
Duplicate vertex names
In addition: Warning message:
In graph.data.frame(pl, directed = TRUE, vertices = pt) :
In `d' `NA' elements were replaced with string "NA"
> cl<-closeness(g, mode = c("out"),weights = NULL, normalized = TRUE)
Error in match(x, table, nomatch = 0L) : object 'g' not found
>
<http://r-sig-geo.2731867.n2.nabble.com/file/n7587719/R_error.jpg>
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/input-shapefile-to-build-graph-using-R-tp7587718p7587719.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list