Hi Roger et. al.! Again, let me start by thanking the Spatial R group for almost 2 years of fantastic help in my research. I am currently working on a part of my puzzle that can be easily done in image processing software such as ENVI but I am looking for an R solution. I have a list of lines objects gathered as a SpatialLines object that "sits" on top of a SpatialGridDataFrame object. I would like to collect all of the spectral intensity values (or z values) from the "SpatialGridDataFrame" object that lie along the transect made from any line of my SpatialLines object. Here is imaginary code for what I would like to accomplish
library(sp) tmp.lines <- Lines(Line(rbind(rank.max2.test[1,1:2], tmp.coords[1,])), ID=as.character(1)) looplen <- nrow(tmp.coords) for ( i in 2:looplen){ i <- Lines(Line(rbind(rank.max2.test[1,1:2], tmp.coords[i,])), ID=as.character(i)) tmp.lines <- c(tmp.lines, i) } tmp.slines <- SpatialLines(tmp.lines, proj4string = CRS(as.character(NA))) where rank.max2.test[1,1:2] [1] 945112.5 859834.5 And tmp.coords[1,] [1] 945110.6 859848.5 ## The above code works great at producing a SpatialLines object with nrow(tmp.coords) lines NOW the part that doesn't work Transect.values <- overlay(SGDF, tmp.slines[1]) Where SGDF is an object of class SpatialGridDataFrame. Can this be accomplished as a SpatialLines class (or some polyline general class) or does the overlay need points? If I must use points to extract the SGDF values, is there a way to convert the SpatialLines object into a set of point coordinates at fixed intervals along the line. Currently the lines are only defined as starting and ending coordinates but I would want the line "points" to occur every 1 meter along the line transect. Many thanks in advance for any help in this endeavor, Andrew Andrew Niccolai Doctoral Candidate Yale University office (203) 432-5144 cell (860) 402-6079 _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo