Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (5.3k points)
edited by

The issue here is not exactly how to plot maps through R, as I have found already a pretty nice example here, but rather how to make it work. I am unable to load library rgdal:

library(rgdal)

Error in library(rgdal) : there is no package called ‘rgdal’

However, when I try to install the above package manually, I get the following error:

....

configure: error: proj_api.h not found in standard or given locations.

ERROR: configuration failed for package ‘rgdal’

* removing ‘/home/eualin/R/i686-pc-linux-gnu-library/2.15/rgdal’

Warning in install.packages : installation of package ‘/home/eualin/Downloads/rgdal_0.8-5.tar.gz’ had non-zero exit status

Any input welcome!

1 Answer

0 votes
by
edited by

According to the rgdal package manual:

SystemRequirements:

for building from source: GDAL >= 1.11.4, library from https://trac.osgeo.org/gdal/wiki/DownloadSource and PROJ.4 (proj >= 4.8.0) from https://download.osgeo.org/proj/; GDAL OSX frameworks built by William Kyngesburye at http://www.kyngchaos.com/ may be used for source installs on OSX. For installation with older external dependencies, override configure checks with --configure-args="enable-deprecated=yes". Consider source installations using archived versions of rgdal contemporary with installed external dependencies, for example, rgdal_0.8-7 for PROJ4 4.8.0 (March 2012).

If you are under Linux, you have to build a package from the source, and you will have to install the corresponding libraries on your system. If you are under Mint, Ubuntu or another Debian derivative, you can do :

$ sudo apt-get install libgdal1-dev libproj-dev

One tip that can be useful under a Debian system is to install the apt-file package and run :

$ sudo apt-file update

If you  get an error such as :

configure: error: proj_api.h not found in standard or given locations.

You can use the following command to find which package you must install to get the missing file :

$ apt-file search proj_api.h libproj-dev: /usr/include/proj_api.h

Browse Categories

...