gdal_setInstallation: gdal_setInstallation

Description Usage Arguments Details Value Author(s) References Examples

View source: R/gdal_setInstallation.R

Description

Sets local GDAL installation options

Usage

1
2
3
4
5
6
gdal_setInstallation(
  search_path = NULL,
  rescan = FALSE,
  ignore.full_scan = TRUE,
  verbose = FALSE
)

Arguments

search_path

Character. Force a search in a specified directory. This directory should contain the gdalinfo(.exe) executable. If a valid GDAL install is found in this path, this will force gdalUtils to use this installation. Remember to set rescan=TRUE if you have already set an install.

rescan

Logical. Force a rescan if neccessary (e.g. if you updated your GDAL install).

ignore.full_scan

Logical. If FALSE, perform a brute-force scan if other installs are not found. Default is TRUE.

verbose

Logical. Enable verbose execution? Default is FALSE.

Details

This function searches the local system for valid installations of GDAL, and returns a list, one item per valid GDAL install, containing the path to the installation, the version, the release date, available drivers, and available python utilities. The list will be sorted by release date, so in general the first entry is the one that is used by the various GDAL utilities. Note that this will automatically run every time a GDAL wrapper function is called, so the user does not have to explicitly run it.

gdal_setInstallation is designed to invoke consecutively more rigorous searches in able to find a valid GDAL install. Understanding the search routine may help debug problems on your system. The order of the searches is as follows, noting that as soon as a valid install is found (determined by running gdalinfo –version and getting the correct output), gdal_setInstallation stops further searching:

  1. Checks a pre-determined location given by the search_path parameter.

  2. Checks using Sys.which(). This is typically defined in the system's PATH, so will override any other install.

  3. Checks in common install locations (OS specific).

  4. (optional, if ignore.full_scan=FALSE) Finally, if it can't find a valid GDAL install anywhere else, it will brute-force search the entire local system (which may take a long time).

Value

Sets an option "gdalUtils_gdalPath" with GDAL installation information.

Author(s)

Jonathan A. Greenberg (gdalUtils@estarcion.net) and Matteo Mattiuzzi

References

http://www.gdal.org/gdal_translate.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run:  
# Assumes you have GDAL installed on your local machine.
getOption("gdalUtils_gdalPath")
gdal_setInstallation()
getOption("gdalUtils_gdalPath")
# If there is more than one installation of GDAL, this is the 
# most recent installation:
getOption("gdalUtils_gdalPath")[[1]]
# The version number:
getOption("gdalUtils_gdalPath")[[1]]$version

## End(Not run)

Example output

NULL
sh: 1: cannot create /dev/null: Permission denied
Warning messages:
1: In gdal_setInstallation() :
  No GDAL installation found. Please install 'gdal' before continuing:
	- www.gdal.org (no HDF4 support!)
	- www.trac.osgeo.org/osgeo4w/ (with HDF4 support RECOMMENDED)
	- www.fwtools.maptools.org (with HDF4 support)

2: In gdal_setInstallation() : If you think GDAL is installed, please run:
gdal_setInstallation(ignore.full_scan=FALSE)
NULL
NULL
NULL

gdalUtils documentation built on Feb. 14, 2020, 1:08 a.m.