Tiled processing rgrass7

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Tiled processing rgrass7

Vinicio Lima
Dears,



I'm running GRASS 7.8.3 from within R, my goal is to run r.surf.contour to
generate a DEM from a vector file of contour lines.



To overcome the low memory, I tiled the contour lines after converting them
to raster. Now I don't know how to access the tiles in the mapset to apply
r.surf.contour.



When I map the tiles in the mapset and try to store the grass names in an
object in R, I get an empty object.



grass.names <- execGRASS(cmd="g.list", type='raster',
pattern='r_contours_tile*')



Can someone indicate some material or a concrete example of how to run a
GRASS tool on tiled data using rgrass7?



sessionInfo()

R version 3.6.2 (2019-12-12)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 10 x64 (build 17134)

attached packages:

[1] rgrass7_0.2-1 XML_3.99-0.3  link2GI_0.4.3



--
Vinício C. Lima
Geo Analyst
*Arauco Brasil **www.arauco.c* <http://www.arauco.cl/>*om.br
<http://om.br/>*

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Tiled processing rgrass7

Micha Silver

On 22/05/2020 17:51, Vinicio Lima wrote:

> Dears,
>
>
>
> I'm running GRASS 7.8.3 from within R, my goal is to run r.surf.contour to
> generate a DEM from a vector file of contour lines.
>
>
>
> To overcome the low memory, I tiled the contour lines after converting them
> to raster. Now I don't know how to access the tiles in the mapset to apply
> r.surf.contour.
>
>
>
> When I map the tiles in the mapset and try to store the grass names in an
> object in R, I get an empty object.
>
>
>
> grass.names <- execGRASS(cmd="g.list", type='raster',
> pattern='r_contours_tile*')
>
>
>
> Can someone indicate some material or a concrete example of how to run a
> GRASS tool on tiled data using rgrass7?
>

Try the parameter 'intern = TRUE' to execGRASS to get a string with
space separated names of rasters:


library(rgrass7)
initGRASS(gisBase="/usr/lib/grass76", gisDbase="/home/micha/GIS/grass",

     location="nc_basic_spm_grass7",

     mapset="PERMANENT",

     override=TRUE)

rast_list = execGRASS('g.list', type='rast', pattern='elev*', intern = TRUE)
rast_list = strsplit(rast_list, split=" ", fixed=TRUE)
rast_list
[[1]]
[1] "elevation"

[[2]]
[1] "elevation_shade"


>
> sessionInfo()
>
> R version 3.6.2 (2019-12-12)
>
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> Running under: Windows 10 x64 (build 17134)
>
> attached packages:
>
> [1] rgrass7_0.2-1 XML_3.99-0.3  link2GI_0.4.3
>
>
>
--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918
https://orcid.org/0000-0002-1128-1325

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo