<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Gadugi;
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-fareast-language:NO-BOK;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="NO-BOK" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi Mehrdad,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">If this is a permission issue, and the dependencies (and a build environment) are installed, you could try compile GRASS (and install it in your home directory if necessary with the
 --prefix configure option).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">svn checkout
<a href="https://svn.osgeo.org/grass/grass/">https://svn.osgeo.org/grass/grass/</a> grass_trunk<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">cd grass_trunk<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">./configure
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">make<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">make install<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">The make install step is not required for starting GRASS though. The make commando creates a bin…/ directory within the grass_trunk dir, where the grass startupscript is located…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Hope that helps.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Stefan<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> grass-user <grass-user-bounces@lists.osgeo.org>
<b>On Behalf Of </b>Mehrdad Varedi<br>
<b>Sent:</b> søndag 28. april 2019 18:31<br>
<b>To:</b> Micha Silver <tsvibar@gmail.com><br>
<b>Cc:</b> grass-user <grass-user@lists.osgeo.org><br>
<b>Subject:</b> Re: [GRASS-user] Help; Running Grass from R without installing GRASS<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Thank you for your time and sharing your knowledge Micha for the second time.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I followed your code and found that initGRASS searches for libraries and binaries of GRASS in gisBase folder. If we address a folder that doesn't have the code it comes back with this error message: "The code execution cannot proceed because
 libgrass_gis.7.4.1.dll was not found. Reinstalling the program may fix this problem." it gives the same error even if I copy that file into GISBase folder.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I want to run my code on a shiny server which I can't install GRASS although I can copy files and libraries. Can I solve this issue by copying a certain folder of GRASS binaries with my app or I am going the wrong path?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Please advise,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you once again for all the time you share to answer my questions,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Mehrdad<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><img border="0" id="_x0000_i1025" src="https://mailfoogae.appspot.com/t?sender=admFyZWRpQGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=6036490f-455f-4578-9a0d-ec0122c7134a"><span style="font-size:7.5pt;font-family:"Gadugi",sans-serif;color:white">ᐧ</span><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Sun, Apr 28, 2019 at 10:55 AM Micha Silver <<a href="mailto:tsvibar@gmail.com">tsvibar@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 27/04/2019 22:05, Mehrdad Varedi wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal">Hi Everyone, <o:p></o:p></p>
<div>
<p class="MsoNormal">I have detail explanations of connecting to an existing dataset in GRASS from R in this address: <a href="https://grasswiki.osgeo.org/wiki/R_statistics/rgrass7" target="_blank">https://grasswiki.osgeo.org/wiki/R_statistics/rgrass7</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">What I hope I could do is to create a GRASS dataset in R on the fly and without the need to install GRASS or create a dataset on it. Is there any way to do this?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</blockquote>
<p>Maybe this will help:<o:p></o:p></p>
<p>(You must have GRASS installed, of course)<o:p></o:p></p>
<p><o:p> </o:p></p>
<p><tt><span style="font-size:10.0pt"># Parameters for the GRASS installation and temporary GRASS mapset</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">GISBase = "/usr/lib/grass76"</span></tt><br>
<tt><span style="font-size:10.5pt"># Set these as you like</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">GISDbase = "/tmp"</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>Location = "tmp_location"</tt><br>
<tt>Mapset = "tmp_mapset"</tt><br>
<tt>georef = "EPSG:2039"</tt><br>
<br>
<tt>mapset_path = file.path(GISDbase, Location, Mapset)</tt></span><o:p></o:p></p>
<p><tt><span style="font-size:13.5pt"># Now run the 'grass' command within R and </span>
</tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt"># use the -c and -e flags to create the temp mapset, then exit</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">setup_grass_cmd = paste("grass", "-c", georef, "-e", mapset_path)</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">system(setup_grass_cmd)</span></tt><o:p></o:p></p>
<p><o:p> </o:p></p>
<p><span style="font-size:13.5pt;font-family:"Courier New""># Load the R grass interface and initialize GRASS within R,
</span><o:p></o:p></p>
<p><span style="font-size:13.5pt;font-family:"Courier New""># using the temporary mapset from above</span><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">library(rgrass7)</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>initGRASS(home=tempdir(), </tt><br>
<tt>          gisBase = GISBase,</tt><br>
<tt>          gisDbase = GISDbase,</tt><br>
<tt>          location = Location,</tt><br>
<tt>          mapset = Mapset,</tt><br>
<tt>          remove_GISRC = TRUE)</tt></span><o:p></o:p></p>
<p><o:p> </o:p></p>
<p><tt><span style="font-size:10.0pt"># Try some GRASS commands</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">input_tif = "isrlat12.tif" </span></tt><o:p></o:p></p>
<p style="margin-bottom:12.0pt"><tt><span style="font-size:10.0pt">grass_rast = "isrlat12"</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>execGRASS("r.in.gdal",  flags = c("o","overwrite"),</tt><br>
<tt>          input = input_tif,</tt><br>
<tt>          output = grass_rast)</tt><br>
<tt>execGRASS("g.region", flags="p", raster = grass_rast)</tt></span><o:p></o:p></p>
<p>I did not add a command to remove the temporary mapset.  Something like:<o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">unlink(file.path(GISDbase, Location), recusive = TRUE)</span></tt> might be necessary<o:p></o:p></p>
<p><o:p> </o:p></p>
<p>One other note: you probably will get better suggestions on the R-sig-geo list...<o:p></o:p></p>
<p><o:p> </o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal">i.e. I have a vector /raster file and use that to identify the region and details required to set up a dataset and use GRASS functions just by including rgrass library.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks for your help and attention,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Mehrdad<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<p class="MsoNormal">Mehrdad Varedi<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><img border="0" id="_x0000_i1026" src="https://mailfoogae.appspot.com/t?sender=admFyZWRpQGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=dbe7ab29-5a21-45c9-97bb-082f4f48224a"><span style="font-size:7.5pt;font-family:"Gadugi",sans-serif;color:white">ᐧ</span><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>grass-user mailing list<o:p></o:p></pre>
<pre><a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><o:p></o:p></pre>
<pre><a href="https://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><o:p></o:p></pre>
</blockquote>
<pre>-- <o:p></o:p></pre>
<pre>Micha Silver<o:p></o:p></pre>
<pre>Ben Gurion Univ.<o:p></o:p></pre>
<pre>Sde Boker, Remote Sensing Lab<o:p></o:p></pre>
<pre>cell: +972-523-665918<o:p></o:p></pre>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<p class="MsoNormal">Mehrdad Varedi<o:p></o:p></p>
</div>
</div>
</body>
</html>