Bindings to the GDAL Raster API
gdalraster-package.Rd
gdalraster
is an interface to the Geospatial Data Abstraction
Library (GDAL) for low level raster I/O. Calling signatures resemble those
of the native C, C++ and Python APIs provided by the GDAL project.
See https://gdal.org/api/ for details of the GDAL Raster API.
Details
Core functionality is contained in class GDALRaster
and several
related stand-alone functions:
GDALRaster-class
is an exposed C++ class that allows opening a raster dataset and calling methods on theGDALDataset
,GDALDriver
andGDALRasterBand
objects in the underlying API (e.g., get/set parameters, read/write pixel data).raster creation:
create()
,createCopy()
,rasterFromRaster()
,translate()
,getCreationOptions()
virtual raster:
autoCreateWarpedVRT()
,buildVRT()
,rasterToVRT()
reproject/resample/crop/mosaic:
warp()
algorithms:
dem_proc()
,fillNodata()
,footprint()
,polygonize()
,rasterize()
,sieveFilter()
,GDALRaster$getChecksum()
raster attribute tables:
buildRAT()
,displayRAT()
,GDALRaster$getDefaultRAT()
,GDALRaster$setDefaultRAT()
geotransform conversion:
apply_geotransform()
,get_pixel_line()
,inv_geotransform()
coordinate transformation:
transform_xy()
,inv_project()
spatial reference convenience functions:
epsg_to_wkt()
,srs_to_wkt()
,srs_find_epsg()
,srs_get_name()
,srs_is_geographic()
,srs_is_projected()
,srs_is_same()
geometry convenience functions:
bbox_from_wkt()
,bbox_to_wkt()
,bbox_intersect()
,bbox_union()
,bbox_transform()
,g_area()
,g_buffer()
,g_centroid()
,g_contains()
,g_crosses()
,g_difference()
,g_disjoint()
,g_distance()
,g_equals()
,g_intersection()
,g_intersects()
,g_is_empty()
,g_is_valid()
,g_length()
,g_make_valid()
,g_name()
,g_overlaps()
,g_summary()
,g_sym_difference()
,g_touches()
,g_transform()
,g_union()
,g_within()
,g_wk2wk()
,geos_version()
data management:
addFilesInZip()
,copyDatasetFiles()
,deleteDataset()
,renameDataset()
,bandCopyWholeRaster()
OGR vector utilities:
ogr2ogr()
,ogrinfo()
,ogr_manage
,ogr_define
virtual file systems:
VSIFile
,vsi_clear_path_options()
,vsi_copy_file()
,vsi_curl_clear_cache()
,vsi_get_disk_free_space()
,vsi_get_file_metadata()
,vsi_get_fs_options()
,vsi_get_fs_prefixes()
,vsi_mkdir()
,vsi_read_dir()
,vsi_rename()
,vsi_rmdir()
,vsi_set_path_option()
,vsi_stat()
,vsi_supports_rnd_write()
,vsi_supports_seq_write()
,vsi_sync()
,vsi_unlink()
,vsi_unlink_batch()
GDAL configuration:
gdal_version()
,gdal_formats()
,get_cache_used()
,get_config_option()
,set_config_option()
,get_num_cpus()
,get_usable_physical_ram()
,has_spatialite()
,http_enabled()
,push_error_handler()
,pop_error_handler()
,dump_open_datasets()
PROJ configuration:
proj_version()
,proj_search_paths()
,proj_networking()
Additional functionality includes:
RunningStats-class
calculates mean and variance in one pass. The min, max, sum, and count are also tracked (efficient summary statistics on data streams).CmbTable-class
implements a hash table for counting unique combinations of integer values.combine()
overlays multiple rasters so that a unique ID is assigned to each unique combination of input values. Pixel counts for each unique combination are obtained, and combination IDs are optionally written to an output raster.calc()
evaluates an R expression for each pixel in a raster layer or stack of layers. Individual pixel coordinates are available as variables in the R expression, as either x/y in the raster projected coordinate system or inverse projected longitude/latitude.plot_raster()
displays raster data using base Rgraphics
. Supports single-band grayscale, RGB, color tables and color map functions (e.g., color ramp).
Author
GDAL is by: Frank Warmerdam, Even Rouault and others
(see https://github.com/OSGeo/gdal/graphs/contributors)
R interface/additional functionality: Chris Toney
Maintainer: Chris Toney <chris.toney at usda.gov>
See also
GDAL Raster Data Model:
https://gdal.org/user/raster_data_model.html
Raster format descriptions:
https://gdal.org/drivers/raster/index.html
Geotransform tutorial:
https://gdal.org/tutorials/geotransforms_tut.html
GDAL Virtual File Systems:
https://gdal.org/user/virtual_file_systems.html
Note
Documentation for GDALRaster-class
and several wrapper functions
borrows from the GDAL API documentation, (c) 1998-2024, Frank Warmerdam,
Even Rouault, and others, MIT license.
Sample datasets included with the package are used in examples throughout the documentation. The sample data include LANDFIRE raster layers describing terrain, vegetation and wildland fuels (LF 2020 version), Landsat C2 Analysis Ready Data from USGS Earth Explorer, and Monitoring Trends in Burn Severity (MTBS) fire perimeters from 1984-2022. Metadata for the sample datasets are in inst/extdata/metadata.zip.
system.file()
is used in the examples to access the sample datasets.
This enables the code to run regardless of where R is installed. Users will
normally give file names as a regular full path or relative to the current
working directory.
Temporary files are created in some examples which have cleanup code wrapped
in dontshow{}
. While the cleanup code is not shown in the
documentation, note that this code runs by default if examples are run with
example()
.