[R-sig-Geo] Can plotKML produces <region> kmls to plot raster stack for large areas?

Amit Boshale amit.boshale at yahoo.com
Fri Apr 24 23:24:05 CEST 2015


Hi All, 

I want to display MODIS rasterStack (300 images, area 1200 km x 1200 km)on Google Earth using plotKML, can I do that?
The code provided in RasterBrickTimeSeries in the tutorial worked well for small areas, but I don't know what to do for large areas
Best,Amit
Tuturial code (working on my data)
> require(raster)
> require (plotKML)
> data(LST)
> gridded(LST) <- ~lon+lat
> proj4string(LST) <- CRS("+proj=longlat +datum=WGS84")
> dates <- sapply(strsplit(names(LST), "LST"), function(x){x[[2]]})
> datesf <- format(as.Date(dates, "%Y_%m_%d"), "%Y-%m-%dT%H:%M:%SZ")
> # begin / end dates +/- 4 days:
> TimeSpan.begin = as.POSIXct(unclass(as.POSIXct(datesf))-4*24*60*60, origin="1970-01-01")
> TimeSpan.end = as.POSIXct(unclass(as.POSIXct(datesf))+4*24*60*60, origin="1970-01-01")
> # pick few climatic stations:
> pnts <- HRtemp08[which(HRtemp08$NAME=="Pazin")[1],]
> pnts <- rbind(pnts, HRtemp08[which(HRtemp08$NAME=="Crni Lug - NP Risnjak")[1],])
> pnts <- rbind(pnts, HRtemp08[which(HRtemp08$NAME=="Cres")[1],])
> coordinates(pnts) <- ~Lon + Lat
> proj4string(pnts) <- CRS("+proj=longlat +datum=WGS84")
> # get the dates from the file names:
> LST_ll <- brick(LST[1:5])
> LST_ll at title = "Time series of MODIS Land Surface Temperature (8-day mosaics) images"
> LST.ts <- new("RasterBrickTimeSeries", variable = "LST", sampled = pnts,
+     rasters = LST_ll, TimeSpan.begin = TimeSpan.begin[1:5], TimeSpan.end = TimeSpan.end[1:5])
> data(SAGA_pal)
> # plot MODIS images in Google Earth:
> plotKML(LST.ts, colour_scale=SAGA_pal[[1]])





	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list