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

Markus Neteler neteler at osgeo.org
Wed May 20 01:10:31 PDT 2020


Hi Mehrdad,

On Wed, May 20, 2020 at 9:06 AM Mehrdad Varedi <varedi at waterlix.com> wrote:

> 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*
>

Here you only copy (if I am not mistaken) the grass79 folder but not the
related system-wide installed PROJ, GDAL etc libs.
They are in /usr/lib[64]/... (don't know precisely right now).


> *COPY --from=thegrass /data /data*
>
> *COPY --from=thegrass /home/grass /home/grass*
>
>
> *RUN sudo apt-get install -y libcurl4-openssl-dev libxml2-dev*
>

I suppose you also need to install the geo software stack here as well (see
https://hub.docker.com/r/neteler/grassgis7/dockerfile
)


> 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 directory
>
>
Yes, because it isn't there yet (see above).

Hope this helps,

Markus


In 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
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user



-- 
Markus Neteler, PhD
https://www.mundialis.de - free data with free software
https://grass.osgeo.org
https://courses.neteler.org/blog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20200520/e9352bdf/attachment.html>


More information about the grass-user mailing list