
Hello everybody,

I am trying to make a commuter-map, where lines going from one region to all the surrounding regions represent the amount of commuters by there thickness.

Let's say I do this for region number 1: I create a dataframe with all the coordinate couples of an inner point of region number 1 to the inner points of 2 surrounding regions. then I make a loop, that creates a list containing all the single lines from this point. 

Now for my mapping, I'd like to have a SpatialLineDataFrame -> somehow I cannot create a SpatialLine form my Line-object. Firstly I create the list with all the single Line-objects in it. Then I create a Lines-object by just simply adding an ID. For the SpatialLines I seem to need a proj4string-specification? I tried to use one of a different Shapefile, that uses the same coordinate-system etc. but that doesnt work. 

I am sure this is a basic problem, can anyone help me?
Thanks in advance

Jacqueline





t.coord <- data.frame(gemvon=c(1,1), gemnach=c(1,2), XCOORD_1= c(682460.5, 682460.5), YCOORD_1=c(248579.4, 248579.4), XCOORD_2 <- c(685766.5, 674783.5), YCOORD_2 <- c(253025.6, 248746.7))
head(t.coord)
#  gemvon gemnach XCOORD_1 YCOORD_1 XCOORD_2 YCOORD_2
#1      1       1 682460.5 248579.4 685766.5 253025.6
#2      1       2 682460.5 248579.4 674783.5 248746.7


# list of single lines (as an example: only two lines)

t.linelist 	<- list()

for (j in 1:2) {

t.linelist[[j]]			<- Line(rbind(c(t.coord[j, 3], t.coord[j, 4]), c(t.coord[j, 5], t.coord[j, 6])) )
}

t.linelist

[[1]]
An object of class "Line"
Slot "coords":
         [,1]     [,2]
[1,] 682460.5 248579.4
[2,] 685766.5 253025.6


[[2]]
An object of class "Line"
Slot "coords":
         [,1]     [,2]
[1,] 682460.5 248579.4
[2,] 674783.5 248746.7

t.lines1 <- SpatialLines(Lines(t.linelist, ID=1) )

Fehler in as.list.default(X) : 
  Keine Methode um diese S4 Klasse in einen Vektor zu verwandeln







Disclaimer\ \ Die in dieser E-Mail enthaltenen Informati...{{dropped:27}}

