<div dir="ltr"><div>Hi, <br></div><div><br></div><div>pls write to grass-stats list where you can get more answers. What version of rgrass7 are you using? The last one includes the possibility to use either sp or sf for vector data. When I run readVECT for example, I first run either use_sp() or use_sf(). Maybe that has something to do with the error? Just guessing...</div><div><br></div><div>HTH,</div><div>Vero<br></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié., 28 ago. 2019 a las 20:33, Micha Silver (<<a href="mailto:tsvibar@gmail.com">tsvibar@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
    
  
  <div style="direction:ltr" bgcolor="#FFFFFF">
    <br>
    <div class="gmail-m_465049727965034761moz-cite-prefix">On 28/08/2019 21:12, Mehrdad Varedi
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hi Micha,
        <div>Your answer makes perfect sense. Thank you. I was expecting
          to get the database when only I had imported raster files! </div>
        <div>Anyway, when I tried to import a vector file with the
          following command, I got an error:</div>
        <div><br>
        </div>
        <div><b>execGRASS("v.import", parameters=list(<br>
                            input =  basename(inputWM),<br>
                            output = "WM"<br>
                            ),<br>
                      flags=c("overwrite"))<br>
          </b></div>
        <div><br>
        </div>
        <div>Here is the error: </div>
        <div><br>
        </div>
        <div><b>In system(cmd0, intern = TRUE) :<br>
              running command 'v.import.bat --interface-description' had
            status 1<br>
            Error in parseGRASS(cmd, legacyExec = legacyExec) : v.import
            not parsed<br>
          </b></div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>I traced the code and found that the parseGRASS adds the
          .bat extension for the v.import and the lagacyExec has a TRUE
          value (default for Windows OS)</div>
        <div><br>
        </div>
        <div>FYI, I couldn't run GRASS from Rstudio unless ran the
          RStudio from the "OSGeo4W" environment. It helps RStudio to
          find the functions in GRASS. (I learned it from a previous
          post). So it works and importing the raster files had no
          problem (I imported a virtual raster .vrt with "r.in.gdal"
          command). Also, I processed the raster file with no problem.
          The problem only shows up when I try to import the vector
          files with r.import command.<br>
        </div>
        <div><br>
        </div>
        <div>Any idea what is happening here? <br>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>No, sorry.</p>
    <p>I expect others on the list with more experience with Windows
      installations will be able to help.</p>
    <p><br>
    </p>
    <blockquote type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <div>Thanks for your help,</div>
        <div><br>
        </div>
        <div>Mehrdad</div>
        <div> <br>
        </div>
        <div><br>
        </div>
      </div>
      <div hspace="streak-pt-mark" style="max-height:1px"><img alt="" style="width: 0px; max-height: 0px; overflow: hidden;" src="https://mailfoogae.appspot.com/t?sender=admFyZWRpQGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=ea09090a-3525-4d19-8c5e-e0143cdd604c"><font size="1" color="#ffffff">ᐧ</font></div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Aug 28, 2019 at 6:24
          AM Micha Silver <<a href="mailto:tsvibar@gmail.com" target="_blank">tsvibar@gmail.com</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div style="direction:ltr" bgcolor="#FFFFFF"> <br>
            <div class="gmail-m_465049727965034761gmail-m_7062285347713815583moz-cite-prefix">On
              28/08/2019 9:56, Mehrdad Varedi wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div dir="ltr">Hi Everyone,
                  <div>I used the code from Micha and managed to run
                    grass in R and create a new dataset from R. I can't
                    see the SQLite database in the created folders like
                    the ones I usually get when creating new datasets
                    from GRASS.</div>
                  <div><br>
                  </div>
                  <div>How can I have the new SQlite database? </div>
                  <div><br>
                  </div>
                </div>
              </div>
            </blockquote>
            <p><br>
            </p>
            <p>If you import some vector you'll have the sqlite.db setup
              for you:</p>
            <p>(Following the example from before)</p>
            <p><br>
            </p>
            <p><tt>> input_vect = "Israel_border.gpkg"</tt><tt><br>
              </tt><tt>> grass_vect = "isr_border"</tt><tt><br>
              </tt><tt>> execGRASS("v.import", input=input_vect,
                output=grass_vect, flags="o")</tt><tt><br>
              </tt><tt>Over-riding projection check</tt><tt><br>
              </tt><tt>Check if OGR layer <Israel_border> contains
                polygons...</tt><tt><br>
              </tt><tt> 100%</tt><tt><br>
              </tt><tt>Creating attribute table for layer
                <Israel_border>...</tt><tt><br>
              </tt><tt>Default driver / database set to:</tt><tt><br>
              </tt><tt>driver: sqlite</tt><tt><br>
              </tt><tt>database:
                $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db</tt><tt><br>
              </tt><tt>Importing 1 features (OGR layer
                <Israel_border>)...</tt><tt><br>
              </tt><tt> 100%</tt></p>
            <p><tt><br>
              </tt></p>
            <p>Then in a separate terminal:</p>
            <p><tt>micha@TP480:~$ ll
                /tmp/tmp_location/tmp_mapset/sqlite/</tt><tt><br>
              </tt><tt>total 20</tt><tt><br>
              </tt><tt>drwxr-xr-x 2 micha micha  4096 Aug 28 13:19 ./</tt><tt><br>
              </tt><tt>drwxr-xr-x 6 micha micha  4096 Aug 28 13:19 ../</tt><tt><br>
              </tt><tt>-rw-r--r-- 1 micha micha 12288 Aug 28 13:19
                sqlite.db</tt><tt><br>
              </tt><tt><br>
              </tt></p>
            <p><br>
            </p>
            <blockquote type="cite">
              <div dir="ltr">
                <div dir="ltr">
                  <div>Thanks for your help.</div>
                  <div><br>
                  </div>
                </div>
                <br>
                <div class="gmail_quote">
                  <div dir="ltr" class="gmail_attr">On Sun, Apr 28, 2019
                    at 10:55 AM Micha Silver <<a href="mailto:tsvibar@gmail.com" target="_blank">tsvibar@gmail.com</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                    <div style="direction:ltr" bgcolor="#FFFFFF">
                      <blockquote type="cite">
                        <div dir="ltr">
                          <div>
                            <div>Maybe this will help:<br>
                            </div>
                          </div>
                        </div>
                      </blockquote>
                      <p>(You must have GRASS installed, of course)</p>
                      <p><br>
                      </p>
                      <p><font size="+1"><tt># Parameters for the GRASS
                            installation and temporary GRASS mapset</tt></font></p>
                      <p><font size="+1"><tt>GISBase =
                            "/usr/lib/grass76"</tt></font><br>
                        <font size="+1"><tt><font size="+1"><tt><span style="font-size:14px"># Set these as
                                  you like</span></tt></font></tt></font></p>
                      <p><font size="+1"><tt>GISDbase = "/tmp"</tt><tt><br>
                          </tt><tt>Location = "tmp_location"</tt><tt><br>
                          </tt><tt>Mapset = "tmp_mapset"</tt><tt><br>
                          </tt><tt>georef = "EPSG:2039"</tt><tt><br>
                          </tt><tt><br>
                          </tt><tt>mapset_path = file.path(GISDbase,
                            Location, Mapset)</tt></font></p>
                      <p><tt><font size="+1"># Now run the 'grass'
                            command within R and </font></tt><br>
                      </p>
                      <p><font size="+1"><tt># use the -c and -e flags
                            to create the temp mapset, then exit<br>
                          </tt></font></p>
                      <p><font size="+1"><tt>setup_grass_cmd =
                            paste("grass", "-c", georef, "-e",
                            mapset_path)</tt></font></p>
                      <p><font size="+1"><tt>system(setup_grass_cmd)</tt></font></p>
                      <p><span style="font-size:14px"><font face="monospace"><font size="+1"><br>
                            </font></font></span></p>
                      <p><span style="font-size:14px"><font face="monospace"><font size="+1"># Load the
                              R grass interface and initialize GRASS
                              within R, </font></font></span></p>
                      <p><span style="font-size:14px"><font face="monospace"><font size="+1"># using the
                              temporary mapset from above</font></font></span><br>
                      </p>
                      <p><font size="+1"><tt>library(rgrass7)</tt><tt><br>
                          </tt><tt>initGRASS(home=tempdir(), </tt><tt><br>
                          </tt><tt>          gisBase = GISBase,</tt><tt><br>
                          </tt><tt>          gisDbase = GISDbase,</tt><tt><br>
                          </tt><tt>          location = Location,</tt><tt><br>
                          </tt><tt>          mapset = Mapset,</tt><tt><br>
                          </tt><tt>          remove_GISRC = TRUE)</tt><tt><br>
                          </tt></font></p>
                      <p><font size="+1"><tt><br>
                          </tt></font></p>
                      <p><font size="+1"><tt># Try some GRASS commands</tt></font></p>
                      <p><font size="+1"><tt>input_tif = "isrlat12.tif"
                            <br>
                          </tt></font></p>
                      <p><font size="+1"><tt>grass_rast = "isrlat12"</tt><tt><br>
                          </tt><tt>execGRASS("r.in.gdal",  flags =
                            c("o","overwrite"),</tt><tt><br>
                          </tt><tt>          input = input_tif,</tt><tt><br>
                          </tt><tt>          output = grass_rast)</tt><tt><br>
                          </tt><tt>execGRASS("g.region", flags="p",
                            raster = grass_rast)</tt><tt><br>
                          </tt></font><br>
                      </p>
                      <p>I did not add a command to remove the temporary
                        mapset.  Something like:</p>
                      <p> <tt>unlink(file.path(GISDbase, Location),
                          recusive = TRUE)</tt> might be necessary</p>
                      <p>Micha Silver<br>
                      </p>
                      <pre class="gmail-m_465049727965034761gmail-m_7062285347713815583gmail-m_-7760652768775255896moz-signature" cols="72">Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
                    </div>
                  </blockquote>
                </div>
                <br clear="all">
                <div><br>
                </div>
                -- <br>
                <div dir="ltr" class="gmail-m_465049727965034761gmail-m_7062285347713815583gmail_signature">Mehrdad
                  Varedi</div>
              </div>
              <div hspace="streak-pt-mark" style="max-height:1px"><img alt="" style="width: 0px; max-height: 0px; overflow: hidden;" src="https://mailfoogae.appspot.com/t?sender=admFyZWRpQGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=21afc582-8b6f-47c9-ba1d-ef54adaa0dfb"><font size="1" color="#ffffff">ᐧ</font></div>
            </blockquote>
            <pre class="gmail-m_465049727965034761gmail-m_7062285347713815583moz-signature" cols="72">-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail-m_465049727965034761gmail_signature">Mehrdad Varedi</div>
    </blockquote>
    <pre class="gmail-m_465049727965034761moz-signature" cols="72">-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
  </div>

_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a></blockquote></div>