using R package, plotKML

28 March 2014

plotKML - R package

tech note (2014/02/24): to build this on opensuse 13.1 required installing gcc-fortran and adding softlinks to gfortran.so and quadmath.so

also added pkgs:

  • libgdal
  • gdal
  • libx-devel

also needed and extra repo, to get gdal as best as I can recall.

containerizing (2014/03/28)

I am beginning to like Docker if only as a way to keep a reasonable record of what I’ve done to accomplish a task. Especially ones to use some gluing together of various tools and packages.

  • zypper, since it’s opensuse, install rpm packages
  • javarconf is R command to setup R to use java (needed by OpenStreetMap)
  • then from R install OpenStreetMap and plotKML from CRAN
  • the Dockerfile to a large extent is the documentation.

    FROM mmckeen/opensuse-13-1
    MAINTAINER Stephen Moore, stephen.moore@linux.com
    
    
    RUN zypper update
    RUN zypper --non-interactive install make
    RUN zypper --non-interactive install gcc
    RUN zypper --non-interactive install gcc-c++
    RUN zypper --non-interactive install gcc-fortran
    RUN zypper --non-interactive install libxml2-2
    # libxml2-devel is where xml2-config is, used by R when installing plotKML
    RUN zypper --non-interactive install libxml2-devel
    RUN zypper --non-interactive addrepo --no-gpgcheck http://download.opensuse.org/repositories/Application:/Geo/openSUSE_13.1/ Application:Geo
    RUN zypper --non-interactive install libgdal1
    # libgdal-devel is where gdal-config is, used by R when installing plotKML
    RUN zypper --non-interactive install libgdal-devel
    RUN zypper --non-interactive install gdal
    RUN zypper --non-interactive install proj
    # library OpenStreetMap depends on java 
    RUN zypper --non-interactive install java-1_7_0-openjdk
    RUN zypper --non-interactive install java-1_7_0-openjdk-headless
    RUN zypper --non-interactive install java-1_7_0-openjdk-devel
    RUN zypper --non-interactive install R-base
    RUN zypper --non-interactive install R-base-devel
    
    
    # configure java for R
    RUN R CMD javareconf
    
    
    ADD work/ /home/work/
    WORKDIR /home/work
    
    
    RUN R --slave -f install_OpenStreetMap.R
    
    
    RUN R --slave -f install_plotKML.R
    
    
    VOLUME /data
    
    
    ENTRYPOINT ["R", "--slave", "-f"]
    CMD ["license.R"]
    
  • install_XXXX.R are small R scripts to install the packages

  • install_plotKML.R

    r = getOption("repos")
    #r["CRAN"] = "http://cran.uk.r-project.org"
    r["CRAN"] = "http://ftp.osuosl.org/pub/cran" #Oregon State University Open Source Laboratory
    options(repos = r)
    rm(r)
    
    
    install.packages("plotKML")