Hi List,


I've got a railroad shapefile and a corine land cover raster.

I'd like to perform a land cover comparative analysis between the west side
of the railroad and the right side.

To do that, I tried first to have a raster with values=1 when on the east
and 0 when on the west.
But my calculation is very slow.

Maybe anyone has a better idea on how to accomplish that?

Here is the code, for the moment:

#* *I create a raster of the same extent and resolution as the corine land
cover raster
> track.r <- raster(extent(clc.ov))
> res(track.r) <- res(clc.ov)

# I rasterize it
> track.r <- rasterize(track, track.r)

# I extract the row-col pairs of cells with value 1
> rowCol <- rowColFromCell(track.r, which(track.r[]==1))

# I give the value 1 to each cell which col number is > to that of the
rasterized line cell and of same row
> for (i in seq(1,length(rowCol))) {
  track.r[rowCol[i,1], rowCol[i,2]:ncols] <- 1
}
# too slow.....


Any help would be greatly appreciated,

Mathieu

	[[alternative HTML version deleted]]

