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

Roger Bivand Roger.Bivand at nhh.no
Thu Jun 22 15:48:57 CEST 2006


On Thu, 22 Jun 2006, Andy Bunn wrote:

> 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)
> >

Cany you please try:

image(tdmean, "z", axes=T)
plot(states, add=TRUE)

I don't think there is a lines() method for SpatialLines* objects.

Roger


> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list