[Raster-commits] r432 - pkg/raster/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 26 15:45:59 CEST 2009


Author: rhijmans
Date: 2009-04-26 15:45:59 +0200 (Sun, 26 Apr 2009)
New Revision: 432

Modified:
   pkg/raster/R/KML.R
Log:


Modified: pkg/raster/R/KML.R
===================================================================
--- pkg/raster/R/KML.R	2009-04-25 04:14:01 UTC (rev 431)
+++ pkg/raster/R/KML.R	2009-04-26 13:45:59 UTC (rev 432)
@@ -5,7 +5,6 @@
 # Version 0.8
 # Licence GPL v3
 
-
 KML <- function (raster, filename, col=rainbow(255), maxdim=1000) {
     if (!isLatLon(raster)) { 
         stop("raster must be in geographical coordinates")
@@ -34,7 +33,7 @@
         "<kml xmlns='http://earth.google.com/kml/2.0'>", "<GroundOverlay>")
     kmname <- paste("<name>", name, "</name>", sep = "")
 	
-    icon <- paste("<Icon><href>", imagefile, "</href><viewBoundScale>0.75</viewBoundScale></Icon>", 
+    icon <- paste("<Icon><href>", basename(imagefile), "</href><viewBoundScale>0.75</viewBoundScale></Icon>", 
         sep = "")
     latlonbox <- paste("<LatLonBox><north>", N, "</north><south>", 
         S, "</south><east>", E, "</east><west>", W, "</west></LatLonBox>", 
@@ -46,6 +45,12 @@
     x <- append(x, latlonbox)
     x <- append(x, footer)
     cat(paste(x, sep = "", collapse = "\n"), file = kmlfile, sep = "")
+	
+	kmz <- kmlfile
+	ext(kmz) <- '.kmz'
+	com1 <- paste("7za a -tzip", kmz, kmlfile, imagefile)
+	try(	sss <- system(com1, intern=TRUE) , silent = TRUE)
+	
 }
 
 



More information about the Raster-commits mailing list