<div dir="ltr">Okay it seems nabble really ate my content,<div>this is the code and my grass version</div><div><br></div><div><div>System Info </div><div>GRASS version: 7.0.3 </div><div>GRASS SVN Revision: 67691 </div><div>Build Date: 2016-01-10 </div><div>Build Platform: x86_64-w64-mingw32 </div><div>GDAL/OGR: 1.11.3 </div><div>PROJ.4: 4.9.2 </div><div>GEOS: 3.5.0 </div><div>SQLite: 3.7.17 </div><div>Python: 2.7.5 </div><div>wxPython: 2.8.12.1 </div><div>Platform: Windows-8-6.2.9200 </div></div><div><br></div><div><div># Initialize GRASS</div><div>loc <- initGRASS(gisBase = "C:/GRASS GIS 7.0.3", </div><div> home = tempdir(),</div><div> gisDbase = 'C:/Users/KingGoerge/Documents/GIS DataBase 2',</div><div> location = 'usa',</div><div> mapset = 'kansas-4', override = TRUE )</div><div>loc</div><div># perhabs first create loaction and map before in GUI?</div><div><br></div><div># # # read DEM</div><div>execGRASS("r.in.gdal", flags = c("overwrite", "o"), </div><div> parameters = list(input = 'C:/Users/KingGoerge/Documents/Gis Projekte/GIS Advanced Projekt/Höhenmodell-Kansas/20160429133734_122375530.tif', </div><div> output = "DEM"))</div><div><br></div><div>execGRASS("g.list", parameters = list(type = "rast"))</div><div># set region</div><div>execGRASS("g.region", parameters = list(raster = 'DEM'))</div><div>gmeta()</div><div><br></div><div><br></div><div><br></div><div>### ----------------------------------------------------------------------------</div><div># # extract flow direction + streams from dem:</div><div>execGRASS("r.watershed", flags = "overwrite",</div><div> parameters = list(elevation = "DEM", </div><div> drainage = 'fdir', # save flow direction as raster named "fdir"</div><div> stream = 'stream', # save derived streams as raster named "stream"</div><div> threshold = 750))</div><div># list all rasters available in GRASS-Session</div><div>execGRASS("g.list", parameters = list(type = "rast"))</div><div># now with fdir and stream</div><div><br></div><div># thin streams and convert to line and clean</div><div># thin = make stream 1pixel width</div><div>execGRASS("r.thin", flags = "overwrite", parameters = list(input = 'stream', output = 'stream_t'))</div><div># convert to line vector</div><div>execGRASS("r.to.vect", flags = "overwrite", parameters = list(input = 'stream_t', output = 'streams', type = 'line' ))</div><div># clean vector (see help for more information)</div><div>execGRASS("v.clean", flags = c("overwrite", "c"), parameters = list(input = 'streams', output = 'streams_c', tool = 'break'))</div><div><br></div><div><br></div><div><br></div><div># read sampling sites</div><div>sites3 <- read.table('C:/Users/KingGoerge/Documents/Gis Projekte/GIS Advanced Projekt/Messpunkte_Kansas-formatiert.csv', header = TRUE, sep = ';')</div><div><br></div><div># set coordinates to create a spatial R object</div><div>coordinates(sites3) <- ~longitude + latitude</div><div>plot(sites3)</div><div># write to GRASS</div><div>writeVECT(sites3, "sites_3", v.in.ogr_flags = c("o", "overwrite"))</div><div><br></div><div># list all vectors</div><div>execGRASS("g.list", parameters = list(type = "vect"))</div><div><br></div><div>## snap sites to streams</div><div># add columns to attributed table of sites</div><div># for distance id and coordinates of nearest streams,</div><div>execGRASS("v.db.addcolumn", parameters = list(map = "sites_3", columns = "dist double precision, cats integer, xm double precision, ym double precision"))</div><div># hat den Befehl nicht gefunden, ausführung über GUI in GRASS über Befehlssuche</div><div><br></div><div><br></div><div># calc distance of points to nearest stream</div><div># and save distance and new coordinates to newly created columns</div><div>execGRASS("v.distance", flags = c("overwrite"),</div><div> parameters = list(from = 'sites_2',</div><div> to = 'streams_c',</div><div> output = 'connectors',</div><div> upload = 'dist,cat,to_x,to_y',</div><div> column = 'dist,cats,xm,ym'))</div><div><br></div><div># extract new points (=snapped coordinates) </div><div># save to disc</div><div>execGRASS("v.db.select", flags = c('c', 'overwrite'),</div><div> parameters = list(map = 'sites_2', </div><div> columns = c('xm,ym'),</div><div> file = 'C:/Users/KingGoerge/Documents/Gis Projekte/GIS Advanced Projekt/new_points_kansas.txt'))</div><div># load from disc</div><div>execGRASS("v.in.ascii", flags = c("overwrite"),</div><div> parameters = list(input = 'C:/Users/KingGoerge/Documents/Gis Projekte/GIS Advanced Projekt//new_points_kansas.txt', </div><div> output = "new_sites"))</div><div><br></div><div><br></div><div>### -------------------------------------------------------------------------</div><div>### Calculate catchments</div><div># read new sites</div><div>snapped <- readVECT('new_sites')</div><div># copy sites_id from table to vectordata</div><div>snapped@data$site_id <- sites$site_id</div><div><br></div><div># for each Point in snapped...</div><div>for (i in seq_len(nrow(snapped))) {</div><div> # extract respective point</div><div> take <- snapped[i,] </div><div> message(paste0(i, ' out of ', nrow(snapped)))</div><div> # calculate drainage area</div><div> execGRASS("r.water.outlet", flags = 'overwrite', </div><div> parameters = list(input = 'fdir', # flow direction as input</div><div> output = paste0('da_', take@data$site_id), # save as raster named "da_<site_id>" (da = drainage area)</div><div> coordinates = coordinates(take)[ ,1:2])) # coordinates of point for which drainage should be calculated</div><div> # execGRASS("g.list", parameters = list(type = "rast"))</div><div> # make raster to vector</div><div> execGRASS("r.to.vect", flags = 'overwrite', </div><div> parameters = list(input = paste0('da_', take@data$site_id), # input = "da_<site_id>" (=raster)</div><div> output = paste0('ws_', take@data$site_id), # output = "ws_<site_id>" (=vector polygon)</div><div> type = 'area'))</div><div> # execGRASS("g.list", parameters = list(type = "rast"))</div><div> # execGRASS("g.list", parameters = list(type = "vect"))</div><div> # Add a column 'area_sqkm' for area in <a href="http://sq.km">sq.km</a> to attributed table</div><div> execGRASS("v.db.addcolumn", </div><div> parameters = list(map = paste0('ws_', take@data$site_id),</div><div> columns = "area_sqkm double"))</div><div> # calculate aresa and save to "area_sqkm" column</div><div> execGRASS("v.to.db", parameters = list(</div><div> map = paste0('ws_', take@data$site_id),</div><div> option = 'area',</div><div> columns = 'area_sqkm', units = 'kilometers'))</div><div>}</div></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-05-06 22:11 GMT+02:00 Roger Bivand <span dir="ltr"><<a href="mailto:Roger.Bivand@nhh.no" target="_blank">Roger.Bivand@nhh.no</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You have still not stated your rgrass7 version. This really is important, without knowing this no help is possible. You must give much more detail of what you are actually doing; make sure that rstudio is not getting in the way (it runs R in separate sessions).<br>
<br>
* DO NOT POST IN NABBLE, IT CAN EAT CONTENT*<br>
<br>
Roger<span class=""><br>
<br>
On Fri, 6 May 2016, Maximilian Bakenhus wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Community,<br>
<br>
I am a german student and I work with some other students at a GRASS<br>
Project,<br>
its about watershed modeling of a DEM Projection and snap measuring points<br>
over the new streams. <br>
We do this with the newest version of R Studio and GRASS 7.0.3<br>
<br>
This here is part of our code:<br>
<br>
</blockquote>
<br></span>
Where???<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
As we try do do the last order,<br>
the* v.db.addcolumn*, we retrieve this error:<br>
<br>
*Error in system(cmd0, intern = TRUE) : 'v.db.addcolumn.exe' not found<br>
Error in parseGRASS(cmd, legacyExec = legacyExec) :<br>
v.db.addcolumn not found*<br>
<br>
We really dont know, how to fix it and hope someone here does, cause we need<br>
it very urgent. <br>
Thanks for reading,<br>
have a nice day<br>
<br>
Max<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/R-in-GRASS-v-db-addcolumn-Error-tp5265014.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/R-in-GRASS-v-db-addcolumn-Error-tp5265014.html</a><br>
Sent from the Grass - Stats mailing list archive at Nabble.com.<br>
_______________________________________________<br>
grass-stats mailing list<br>
<a href="mailto:grass-stats@lists.osgeo.org" target="_blank">grass-stats@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-stats" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-stats</a><br>
</blockquote>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Roger Bivand<br>
Department of Economics, Norwegian School of Economics,<br>
Helleveien 30, N-5045 Bergen, Norway.<br>
voice: <a href="tel:%2B47%2055%2095%2093%2055" value="+4755959355" target="_blank">+47 55 95 93 55</a>; fax <a href="tel:%2B47%2055%2095%2091%2000" value="+4755959100" target="_blank">+47 55 95 91 00</a><br>
e-mail: <a href="mailto:Roger.Bivand@nhh.no" target="_blank">Roger.Bivand@nhh.no</a><br>
<a href="http://orcid.org/0000-0003-2392-6140" rel="noreferrer" target="_blank">http://orcid.org/0000-0003-2392-6140</a><br>
<a href="https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en" rel="noreferrer" target="_blank">https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en</a><br>
<a href="http://depsy.org/person/434412" rel="noreferrer" target="_blank">http://depsy.org/person/434412</a><br>
</font></span></blockquote></div><br></div>