Skip to content
Back to formatted view

Raw Message

Message-ID: <NEBBIPHDAMMOKDKPOFFIIECCEFAA.abunn@whrc.org>
Date: 2006-06-22T15:38:10Z
From: Andy Bunn
Subject: Add lines from SpatialLinesDataFrame to an image of SpatialGridDataFrame
In-Reply-To: <Pine.LNX.4.44.0606221543040.17495-100000@reclus.nhh.no>

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


This works. Thanks. Andy



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