gdalUtils (version 0.2.0)

gdalsrsinfo: gdalsrsinfo

Description

R wrapper for gdalsrsinfo: lists info about a given SRS in number of formats (WKT, PROJ.4, etc.)

Usage

gdalsrsinfo(srs_def, p, V, o, additional_commands, as.CRS = FALSE,
  verbose = FALSE)

Arguments

srs_def
Character. A raster dataset name. It can be either file name.
p
Logical. Pretty-print where applicable (e.g. WKT).
V
Logical. Validate SRS.
o
Character. Output type ("default"|"all"|"wkt_all"|"proj4"|"wkt"|"wkt_simple"|"wkt_noct"|"wkt_esri"|"mapinfo"|"xml")
as.CRS
Logical. Return a CRS object? Default=FALSE.
additional_commands
Character. Additional commands to pass directly to gdalsrsinfo.
verbose
Logical.

Value

  • character

Details

This is an R wrapper for the 'gdalsrsinfo' function that is part of the Geospatial Data Abstraction Library (GDAL). It follows the parameter naming conventions of the original function, with some modifications to allow for more R-like parameters. For all parameters, the user can use a single character string following, precisely, the gdalinfo format (http://www.gdal.org/gdalsrsinfo.html), or, in some cases, can use R vectors to achieve the same end.

This function assumes the user has a working GDAL on their system. If the "gdalUtils_gdalPath" option has been set (usually by gdal_setInstallation), the GDAL found in that path will be used. If nothing is found, gdal_setInstallation will be executed to attempt to find a working GDAL.

If as.CRS is set to TRUE, 'o' will automatically be set to "proj4" and the output will be coerced to a CRS object for use with sp.

References

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

Examples

Run this code
src_dataset <- system.file("external/tahoe_highrez.tif", package="gdalUtils")
# Command-line gdalsrsinfo call:
# gdalsrsinfo -o proj4 tahoe_highrez.tif
gdalsrsinfo(src_dataset,o="proj4")
# Export as CRS:
gdalsrsinfo(src_dataset,as.CRS=TRUE)

Run the code above in your browser using DataCamp Workspace