Skip to content
Prev 23513 / 29559 Next

plotKML 'kml' function with raster input

Paul,
Thanks kindly for your response. I am not certain of what you mean. My windows search path has all backslashes (\) although I wasn't clear about this in my example. It is not possible to feed the gdalwarp and gdal_translate paths to plotKML.env() as strings with backslashes in them as they are recognized as escape characters.
I forgot to include library loading in the code I shared previously, and for convenience I do so below...Thanks kindly for any further assistance.

#FIRST: Include path to GDAL install that contains 'gdalwarp.exe' and 'gdal_translate.exe' to windows search path, in my case 'C:\Program Files\GDAL'
#__________________________________
library(raster);library(rgdal);library(plotKML)
#Not sure if necessary, but I tried the following to ensure that paths are set up correctly....
#plotKML.env(gdalwarp = 'C:/Program Files/GDAL', gdal_translate = 'C:/Program Files/GDAL')
# or...
#plotKML.env(gdalwarp = 'C:/Program > Files/GDAL/gdalwarp.exe', gdal_translate = 'C:/Program Files/GDAL/gdal_translate.exe')

kml.folder <- 'c:/dave/temp';kml.file <- 'test.kml'
rast <- raster(extent(-135.2,-135.1,58.1,58.2),nrows=10,ncol=10,crs=CRS('+init=epsg:4326'))
rast[]<-rnorm(ncell(rast))
kml(rast,kml.fold,kml.file,colour = 'black')
#__________________________________

Dave.
-----Original Message-----
From: Paul Woods [mailto:p.woods at qub.ac.uk] 
Sent: Monday, October 12, 2015 2:31 PM
To: Gregovich, Dave P (DFG)
Cc: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] plotKML 'kml' function with raster input

Try changing your forward slashes (/) to backward slashes (\) as per Windows standard?

Paul