[R-sig-Geo] Add lines from SpatialLinesDataFrame to an image of SpatialGridDataFrame

Andy Bunn abunn at whrc.org
Thu Jun 22 15:16:46 CEST 2006


Howdy all: I have a simple question. Given two sp objects, a
SpatialGridDataFrame tdmean and SpatialLinesDataFrame states I want to plot
tdmean as an image and draw the lines on top. Can this be done with sp?


> class(tdmean)
[1] "SpatialGridDataFrame"
attr(,"package")
[1] "sp"
> is.projected(tdmean)
[1] TRUE
> class(states)
[1] "SpatialLinesDataFrame"
attr(,"package")
[1] "sp"
> is.projected(states)
[1] TRUE
> # plot states and put the image on top: works but is unsatisfying
> plot(states,axes=T)
> image(tdmean["z"],add=T)
>
> # plot image and put the state lines on top: doesn't work
> image(tdmean["z"],axes=T)
> lines(states)
>




More information about the R-sig-Geo mailing list