Hello again!

I'm running into a problem with the image function within a loop.  When I put 
it to the screen, it works fine, but when I put it to a PNG file, the picture 
doesn't change.

Here is the code:

for(i in 1:11) {
j1 <- (i-1)*n2 + 1
j2 <- i*n2

 predx <- 
data.frame(pred=kr3$var1.pred[j1:j2],lon=kr3@sp@coords[,1],lat=kr3@sp@coords[,2])

 coordinates(predx) <- ~lon+lat
 proj4string(predx) <- proj4string(kr3)
 predx.wgs84 <- spTransform(predx,CRS("+proj=longlat +datum=WGS84"))
 llSPix <- as(llSGDF, "SpatialPixelsDataFrame")
 (st <- system.time(llSPix$pred <- idw(pred ~ 1,
 loc=predx.wgs84,newdata = llSPix, nmax = 16)$var1.pred))
 cat("stuff",i,"\n")
f1 <- paste("pred",i,"a.png",sep="")
#Works fine
image(llSPix,"pred",col=bpy.colors(),main=f1)


 assign("file1",f1)
 cat("filen",file1,"\n")
 png(filename = file1, width = GRD.wgs84$width,
 height = GRD.wgs84$height,bg="transparent")
 par(mar = c(0, 0, 0, 0), xaxs = "i", yaxs = "i")
 image(llSPix, "pred", col = bpy.colors())
 dev.off()
 kmlsetup(obj = GRD.wgs84, kmlfile =filename,
 imagefile = file1, name =as.character(2000+i))

}

Has anyone run into this before, please?

Thanks,
Erin


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to