[R-sig-Geo] plotKML and time stamp

Edzer Pebesma edzer.pebesma at uni-muenster.de
Sun Sep 30 12:05:49 CEST 2012


Juliane, try

xc = round(runif(10,-1,1)+27.2, 2)
yc = round(runif(10,-1,1)+-82.5, 2)
xy = cbind(xc, yc)
tc = Sys.time() + 3600 * (1:10)
df = data.frame(z1 = round(5 + rnorm(10), 2), z2 = 20:29)

library(sp)
xy.sp = SpatialPoints(xy)
proj4string(xy.sp) = CRS("+proj=longlat +datum=WGS84")

library(spacetime)
ST = STIDF(xy.sp, tc, df)

library(plotKML)
plotKML(ST)

see also

vignette(spacetime)


On 09/30/2012 03:39 AM, Struve,Juliane wrote:
> Dear list,
> 
> After plotting this toy example on Google Earth I would like to add a date/time stamp to it so that the locations will be shown in sequence using the time slider. I am not quite sure how to approach this, can I add a date/time to my spatial points and then submit it to plotKML ? What format does the date/time stamp have to be in to be plotted on Google Earth ?
> 
> Many thanks for any suggestions.
> 
> Regards,
> 
> Juliane
> 
> 
> xc = round(runif(10,-1,1)+27.2, 2)
> yc = round(runif(10,-1,1)+-82.5, 2)
> xy = cbind(xc, yc)
> xy.sp = SpatialPoints(xy)
> df = data.frame(z1 = round(5 + rnorm(10), 2), z2 = 20:29)
> SP.spdf = SpatialPointsDataFrame(xy.sp, df)
> plot(SP.spdf)
> #add a projection
> proj4string(SP.spdf) = CRS("+proj=longlat +datum=WGS84")
> plotKML(SP.spdf,kmz = FALSE)
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list