<div dir="ltr">Xavier:<div><br></div><div>It looks like gdalUtils is not finding your install of GDAL -- first question, are you up to date with the latest gdalUtils?  </div><div><br></div><div>gdalUtils will only look in "standard" locations for the installs -- if you have your install in a non-standard location (easy to do with the OSGEO installer, since you can set the install directory to wherever you want it), then you can fix it the following two ways:</div><div><br></div><div>1) Brute force-- as the error above stated, if you run:</div><div>gdal_setInstallation(ignore.full_scan=FALSE)<br></div><div><br></div><div>It will do a brute force search for it on your computer.  This could take awhile, since it is searching your entire hard drive for any and all valid gdal installs (technically, it is looking for the folder with "gdalinfo" or "gdalinfo.exe").  </div><div><br></div><div>A faster step would be before you run gdal_grid to:</div><div>1) Manually s<span style="line-height:1.5">earch on your computer for "gdal_grid.exe" -- you need to know what folder it is hiding in.</span></div><div><span style="line-height:1.5">2) Run:</span></div><div>gdal_setInstallation(search_path="pathto/gdalexecutables",rescan=T)<br></div><div><br></div><div>Note that gdalUtils does NOT use rgdal's install -- rgdal doesn't contain the executables typically, at any rate.</div><div><br></div><div>Hope this helps!  Please let me know if you are still having problems.  I'm going to cc r-sig-geo in this email (with your contact info removed) so there is a record of this suggestion.</div><div><br></div><div>--j</div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="NL-BE" link="#0563C1" vlink="#954F72"><div><p class="MsoNormal"><span lang="EN-US" style="color:black"><br>Dear Jonathan, <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">I am trying to use the R wrapper ‘gdal_grid’ from the ‘gdalUtils’ R package, in order to perform interpolation on a dataset. But I encounter difficulties.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">Running a copy-paste of the example on p 37-38 of the package documentation:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r"># We'll pre-check to make sure there is a valid GDAL install<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r"># and that raster and rgdal are also installed.<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r"># Note this isn't strictly neccessary, as executing the function will<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r"># force a search for a valid GDAL install.<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">gdal_setInstallation()<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">valid_install <- !is.null(getOption("gdalUtils_gdalPath"))<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">if(require(raster) && valid_install)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">{<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r"># Create a properly formatted CSV:<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">temporary_dir <- tempdir()<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">tempfname_base <- file.path(temporary_dir,"dem")<u></u><u></u></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">tempfname_csv <- paste(tempfname_base,".csv",sep="")<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">pts <- data.frame(<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">Easting=c(86943.4,87124.3,86962.4,87077.6),<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">Northing=c(891957,892075,892321,891995),<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">Elevation=c(139.13,135.01,182.04,135.01)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">write.csv(pts,file=tempfname_csv,row.names=FALSE)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r"># Now make a matching VRT file<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">tempfname_vrt <- paste(tempfname_base,".vrt",sep="")<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">vrt_header <- c(<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">'<OGRVRTDataSource>',<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">'\t<OGRVRTLayer name="dem">',<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">'\t<SrcDataSource>dem.csv</SrcDataSource>',<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">'\t<GeometryType>wkbPoint</GeometryType>',<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">'\t<GeometryField encoding="PointFromColumns" x="Easting" y="Northing" z="Elevation"/>',<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="FR" style="font-size:9.0pt;font-family:Inconsolata-zi4r">'\t</OGRVRTLayer>',<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="FR" style="font-size:9.0pt;font-family:Inconsolata-zi4r">'\t</OGRVRTDataSource>'<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">vrt_filecon <- file(tempfname_vrt,"w")<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">writeLines(vrt_header,con=vrt_filecon)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">close(vrt_filecon)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">tempfname_tif <- paste(tempfname_base,".tiff",sep="")<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r"># Now run gdal_grid:<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">setMinMax(gdal_grid(src_datasource=tempfname_vrt,<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">dst_filename=tempfname_tif,a="invdist:power=2.0:smoothing=1.0",<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">txe=c(85000,89000),tye=c(894000,890000),outsize=c(400,400),<u></u><u></u></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">of="GTiff",ot="Float64",l="dem",output_Raster=TRUE))<u></u><u></u></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US" style="font-size:9.0pt;font-family:Inconsolata-zi4r">}</span></i><i><span lang="EN-US" style="color:black"><u></u><u></u></span></i></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">Leads to the following message after the following two lines of code:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:blue;background:#e1e2e5">> library(gdalUtils)<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:blue;background:#e1e2e5">> gdal_setInstallation()<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">Warning messages:<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">1: In gdal_setInstallation() :<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">  No GDAL installation found. Please install 'gdal' before continuing:<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">        - <a href="http://www.gdal.org" target="_blank">www.gdal.org</a> (no HDF4 support!)<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">        - <a href="http://www.trac.osgeo.org/osgeo4w/" target="_blank">www.trac.osgeo.org/osgeo4w/</a> (with HDF4 support RECOMMENDED)<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">        - <a href="http://www.fwtools.maptools.org" target="_blank">www.fwtools.maptools.org</a> (with HDF4 support)<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5"><u></u> <u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">2: In gdal_setInstallation() : If you think GDAL is installed, please run:<u></u><u></u></span></p>
<p class="MsoNormal" style="word-break:break-all"><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">gdal_setInstallation(ignore.full_scan=FALSE)</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Lucida Console";color:black;background:#e1e2e5"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">However, I do have GDAL installed on my computer. GDAL was installed using the option 2 mentioned in the above Warning message (i.e.
<a href="http://trac.osgeo.org/osgeo4w/" target="_blank">http://trac.osgeo.org/osgeo4w/</a>).<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">Also, loading and using the ‘rgdal’ package is no problem, as shown in the small example below:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> </span></span><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">setwd("D:/GIS/Preprocessing/Factories_and_beet_zones")<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> </span></span><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">### Subsetting ".csv" file for operating factories of a given year only<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> </span></span><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">DF <- read.csv(file="Factories.csv", header = TRUE, sep = ";", dec = "," )<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> </span></span><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">DF2 <- subset(DF, Year == "2013")<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> </span></span><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">DF3 <- subset(DF2, Operating == "yes")<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> </span></span><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5"><u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> </span></span><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">### Specifying project CRS<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> </span></span><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">library(rgdal)<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">Loading required package: sp</span></span><span><span lang="EN-US" style="color:#c5060b"><u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">rgdal: version: 1.1-1, (SVN revision 572)<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:#c5060b;background:#e1e2e5"> Geospatial Data Abstraction Library extensions to R successfully loaded<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:#c5060b;background:#e1e2e5"> Loaded GDAL runtime: GDAL 1.11.2, released 2015/02/10<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:#c5060b;background:#e1e2e5"> Path to GDAL shared files: C:/Users/sauvenier.xavier/Documents/R/win-library/3.2/rgdal/gdal<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:#c5060b;background:#e1e2e5"> GDAL does not use iconv for recoding strings.<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:#c5060b;background:#e1e2e5"> Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:#c5060b;background:#e1e2e5"> Path to PROJ.4 shared files: C:/Users/sauvenier.xavier/Documents/R/win-library/3.2/rgdal/proj<u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:#c5060b;background:#e1e2e5"> Linking to sp version: 1.2-1 <u></u><u></u></span></span></pre>
<pre style="word-break:break-all"><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">> </span></span><span><span lang="EN-US" style="font-family:"Lucida Console";color:blue;background:#e1e2e5">project_CRS <- CRS("+init=epsg:4326") #WGS84</span></span><span lang="EN-US" style="color:black"><u></u><u></u></span></pre>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">I have spent quite some time trying to understand what is going on. But so far I have failed.
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<pre style="word-break:break-all"><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">My R version is 3.2.2. My platform is a windows 64-bit (Windows Server 2012 Datacenter). And </span><span lang="EN-US" style="font-family:"Lucida Console";color:black;background:#e1e2e5"><u></u><u></u></span></pre>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">Would you have any idea on what I am doing wrong?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">Thanks for any help.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black"><u></u> </span></p>
</div>
</div>

</blockquote></div></div>