# NOT RUN {
data(eberg)
data(SAGA_pal)
library(sp)
library(rgdal)
coordinates(eberg) <- ~X+Y
proj4string(eberg) <- CRS("+init=epsg:31467")
names(eberg)
# subset to 10 percent:
eberg <- eberg[runif(nrow(eberg))<.1,]
# }
# NOT RUN {
# plot the measured CLAY content:
kml(eberg, labels = CLYMHT_A)
shape = "http://maps.google.com/mapfiles/kml/pal2/icon18.png"
# color only:
kml(eberg, shape = shape, colour = SLTMHT_A, labels = "", colour_scale = SAGA_pal[[1]])
# two variables at the same time:
kml(eberg, shape = shape, size = CLYMHT_A, colour = SLTMHT_A, labels = "")
# two aesthetics elements are effective in emphasizing hot-spots:
kml(eberg, shape = shape, altitude = CLYMHT_A*10, extrude = TRUE,
colour = CLYMHT_A, labels = CLYMHT_A, kmz = TRUE)
# }
# NOT RUN {
## example of how plotKML is programmed:
data(HRtemp08)
HRtemp08[1,]
library(XML)
p1 = newXMLNode("Placemark")
begin <- format(HRtemp08[1,"DATE"]-.5, "%Y-%m-%dT%H:%M:%SZ")
end <- format(HRtemp08[1,"DATE"]+.5, "%Y-%m-%dT%H:%M:%SZ")
txt <- sprintf('<name>%s</name><TimeStamp><begin>%s</begin><end>%s</end></TimeStamp>
<Point><coordinates>%.4f,%.4f,%.0f</coordinates></Point>', HRtemp08[1,"NAME"],
begin, end, HRtemp08[1,"Lon"], HRtemp08[1,"Lat"], 0)
parseXMLAndAdd(txt, parent=p1)
p1
# }
Run the code above in your browser using DataLab