# NOT RUN {
opt_exask <- options(example.ask=FALSE)
qk <- SpatialPointsDataFrame(quakes[, c(2:1)], quakes)
proj4string(qk) <- CRS("+proj=longlat +ellps=WGS84")
tf <- tempfile()
SGqk <- GE_SpatialGrid(qk)
png(file=paste(tf, ".png", sep=""), width=SGqk$width, height=SGqk$height,
bg="transparent")
par(mar=c(0,0,0,0), xaxs="i", yaxs="i")
plot(qk, xlim=SGqk$xlim, ylim=SGqk$ylim, setParUsrBB=TRUE)
dev.off()
kmlOverlay(SGqk, paste(tf, ".kml", sep=""), paste(tf, ".png", sep=""))
# }
# NOT RUN {
#library(rgdal)
#qk0 <- quakes
#qk0$long <- ifelse(qk0$long <= 180, qk0$long, qk0$long-360)
#qk0a <- SpatialPointsDataFrame(qk0[, c(2:1)], qk0)
#proj4string(qk0a) <- CRS("+proj=longlat +ellps=WGS84")
#writeOGR(qk0a, paste(tf, "v.kml", sep=""), "Quakes", "KML")
#system(paste("googleearth ", tf, ".kml", sep=""))
# }
# NOT RUN {
options(example.ask=opt_exask)
# }
Run the code above in your browser using DataLab