Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble getting latest version of GDAL on ubuntu running R

Tags:

r

ubuntu

gdal

My Ubuntu machine has latest GDAL (2.2.1, released 2017/06/23). But R complains that I have gdalversion <2.0

configure: CC: gcc -std=gnu99
configure: CXX: g++
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 1.11.3
checking GDAL version >= 2.0.0... no
configure: error: sf is not compatible with GDAL versions below 2.0.0 

How can I direct R to access GDAL (2.2.1 version) already installed on Ubuntu?

like image 321
sbaniwal Avatar asked Sep 18 '17 23:09

sbaniwal


People also ask

How do I download GDAL on Ubuntu?

To get the latest GDAL/OGR version, add the PPA to your sources, then install the gdal-bin package (this should automatically grab any necessary dependencies, including at least the relevant libgdal version). Once you add the repository, go ahead and update your source packages.

How do I know if GDAL is installed Ubuntu?

To test your installation, run the terminal command gdalinfo --version . A correct installation will output something like GDAL 1.9.

What is GDAL config?

Description. This utility script (available on Unix systems) can be used to determine various information about a GDAL installation. It is normally just used by configure scripts for applications using GDAL but can be queried by an end user.


2 Answers

You may need to uninstall all traces of gdal then re-install it from the ubuntugis-unstable source. The following helped me solve a similar problem:

sudo apt remove libgdal-dev
sudo apt remove libproj-dev
sudo apt remove gdal-bin
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable

Make sure a version >= 2.0 appears when you execute this line:

sudo apt-cache policy libgdal-dev

If so, run:

sudo apt update
sudo apt install libgdal-dev

I could then successfully execute in R 3.4.2 in Ubuntu 14.04 ("Trusty Tahr") this:

install.packages('rgdal')
like image 75
Rick Pack Avatar answered Oct 15 '22 21:10

Rick Pack


The following worked for me

sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev

From: https://gist.github.com/dncgst/111b74066eaea87c92cdc5211949cd1e

like image 24
Antonio Avatar answered Oct 15 '22 22:10

Antonio