[GRASS-user] Creating an R Container with GRASS support

Mehrdad Varedi varedi at waterlix.com
Wed May 20 00:06:02 PDT 2020


Hi everybody,
my hope is to reference the necessary files and folders or copy them on an
R image to use GRASS functions in R.

I have a Docker file like the following:

*FROM neteler/grassgis7 as thegrass*


*FROM rocker/rstudio*

*COPY --from=thegrass /usr/local/grass79 /usr/local/grass79*

*COPY --from=thegrass /data /data*

*COPY --from=thegrass /home/grass /home/grass*


*RUN sudo apt-get install -y libcurl4-openssl-dev libxml2-dev*

Then I build and run the image which has a few folders from GRASS GIS
In RStudio, I install and call the "rgrass7" and "raster" libraries. (No
errors)

Then in Rstudio, I try to run the initGRASS function with the following
values:

initGRASS(gisBase = "/usr/local/grass79", home = raster::tmpDir(),
gisDbase = "tmpDbase", location = "Kitchener", mapset = "PERMANENT",
override = TRUE)


This is the error I recieve:Error in parseGRASS(cmd, legacyExec =
legacyExec) : The command
   g.region --interface-description
could not be run (127), and produced the error message:
   g.region: error while loading shared libraries: libproj.so.12:
cannot open shared object file: No such file or directoryIn addition:
Warning message:In system2(command = command, args = arguments, stdout
= outFile,  :  error in running command


Do you know a better way to merge the GRASS GIS files with the R image?
Would you please help me to complete the Dockerfile to avoid such errors?

Kind regards,

Mehrdad


Mehrdad Varedi, M.A.Sc.
Waterlix <http://www.waterlix.com> Inc. Founder
www.waterlix.com
Cell: +1 (519)722-7057
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20200520/3f445c8d/attachment.html>


More information about the grass-user mailing list