Rgdal - bwHPC Wiki Rgdal - bwHPC Wiki


From bwHPC Wiki
Jump to: navigation, search

Installation instructions

Consider starting an interactive job for compiling. Just copy paste this to your shell (please only copy line by line so you see errors fast).

module load math/R
# Get sources
mkdir -p ~/src
cd ~/src
wget http://download.osgeo.org/gdal/2.2.2/gdal-2.2.2.tar.gz
wget http://download.osgeo.org/geos/geos-3.6.2.tar.bz2
wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz
# Not using git version
#git clone https://github.com/OSGeo/proj.4.git

# Build gdal
tar xf gdal-2.2.2.tar.gz
cd gdal-2.2.2
./configure --prefix=$HOME/sw
make -j4
make install
cd ..

# Build geos
tar xf geos-3.6.2.tar.bz2
cd geos-3.6.2
./configure --prefix=$HOME/sw
make -j4
make install
cd ..

# Build proj.4
# Not using git version
#cd proj.4
#git checkout 4.9.3 -b 4.9.3
#git branch
#autoreconf -i
tar xf proj-4.9.3.tar.gz
cd proj-4.9.3
./configure --prefix=$HOME/sw
make -j4
make install
cd ..

# Set up environment (you may want to put these lines in your ~/.bashrc as well)
export PATH=$PATH:$HOME/sw/bin
export MANPATH=$MANPATH:$HOME/sw/man
export GDAL_DATA=$HOME/sw/share/gdal
export CFLAGS=-I$HOME/sw/include

# Install rgdal and rgeos packages from within R session
R -q
# Problem with too many arguments
#install.packages("rgdal", configure.args = c("--with-proj-include=~/sw/include", "--with-proj-lib=~/sw/lib", "--with-proj-share=~/sw/share/proj"))