[R-sig-Geo] clip a SpatialPolygonsDataFrame

Roger Bivand Roger.Bivand at nhh.no
Thu Aug 5 20:38:07 CEST 2010


On Thu, 5 Aug 2010, Laetitia Blanc wrote:

>
> Roger Bivand,
>
> i tried the method with xlim and ylim and it works when i just plot my map
> alone. What i try to do is to insert this map in my animation. Here is the
> code of my animation :
>
> pres.ani <- function()
> {
> for (i in 1:length(unique(d$an))) {
> image(res[,,i],xlab='',ylab='',main=unique(d$an)[i])
> contour(res[,,i],add=T)
> #points(d3[[i]])
> Sys.sleep(.5)
> }
>
> }
> ani.start(interval=.5,title = "movie presence lynx", outdir = getwd())
>
> pres.ani()
> ani.stop()
>
> res[,,i] is my KDE. When i create this animation, the x and y axes range of
> the window is 0:1. How can i put my map (coordinate system : Lambert II) as
> a background  in this animation ?
> I hope it's enough clear...

Can the KDE be run with the correct coordinates in the specified 
projection on the input data, so that thw window matches the outlines? Can 
you re-write the code making res to generate a SpatialGridDataFrame? The 
input points must have a projection. Without a shared projection (CRS, 
coordinate reference system) this is not possible.

Roger

>
> Thank you for your help.
>
>

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