Learn R Programming

geodiv

geodiv calculates gradient surface metrics in R. These metrics are applied to continuous spatial data (i.e., rasters or matrices) and represent spatial heterogeneity.

Installation

You can install the released version of geodiv from CRAN with:

install.packages("geodiv")

And the development version from GitHub with:

# install.packages("devtools")

# install from master branch
devtools::install_github("bioXgeo/geodiv")

# install from development branch
devtools::install_github("bioXgeo/geodiv",ref = "dev")

On Mac OS X, you may need to install the development tools here to get the package to install:

https://cran.r-project.org/bin/macosx/tools/

Example

This is a basic example which shows you how to calculate several metrics over an entire image. geodiv may also be applied with moving windows over an entire image using the ‘texture_image’ function. For a more complex example, see the vignette.

library(geodiv)

# import example raster
data(normforest)

# apply metrics
sa(normforest) # average surface roughness
#> [1] 0.0442945
svk(normforest) # reduced valley depth
#> [1] 0.5449867
ssc(normforest) # mean summit curvature
#> [1] -0.02192238

Copy Link

Version

Install

install.packages('geodiv')

Monthly Downloads

319

Version

1.1.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Kyla Dahlin

Last Published

July 21st, 2026

Functions in geodiv (1.1.1)

remove_plane

Removes the Best Fit Polynomial Surface
pad_edges

Extend edges of a matrix.
sku

Calculates the Kurtosis of Raster Values
slopecalc

Determines the Slopes Along the Bearing Area Curve
orforest

NDVI for a portion of southwestern Oregon, USA.
sdr

Surface Area Ratio
sbi

Surface Bearing Index
slopemeans

Determines the Average Slope Along Larger Segments of the Bearing Area Curve
sds

Summit Density
sci

Core Fluid Retention Index
smean

Calculates the Mean Peak Height of a Surface Image
plot_ba_curve

Plots the Bearing Area Curve
sdq6

Root Area Mean Square Slope of Surface
sdq

Root Mean Square Slope of Surface
sv

Calculates the Maximum Valley Depth of a Surface Image
surface_area

Surface Area
scl

Calculate Correlation Length
s10z

Ten-Point Height
spk

Reduced Peak Height
sq

Calculates the Root Mean Square Roughness of a Surface
sfd

Calculate the fractal dimension of a raster.
sfd_

Calculate the fractal dimension of a raster (C function).
sa

Calculates the Average Roughness of a Surface
rotate

Rotates a matrix 180 degrees.
sph

Calculates the Maximum Peak Height of a Surface Image
texture_image

Calculate Texture Metrics per Pixel
ssc

Mean Summit Curvature
ssk

Calculates the Skewness of Raster Values
window_metric

Calculate Texture Metric for Single Pixel
sk

Core Roughness Depth
simpsons

Simpson's Rule Empirical Area Under a Curve
stxr

Estimate Texture Aspect Ratio
svi

Valley Fluid Retention Index
std

Texture Direction Metrics
sdc

Height Intervals of the Bearing Area Curve
srw

Radial Wavelength Metrics
svk

Reduced Valley Depth
zshift

Offset Raster or Matrix Values
.deg2rad

Degree to Radian Conversion
.maxdist

Estimate Maximum Correlation Length
.mindist

Estimate Minimum Correlation Length
bearing_area

Calculates the Rotated Bearing Area Curve
bestfitplane

Finds the Best Fit Polynomial Surface
.rad2deg

Radian to Degree Conversion
aacf

Estimate the Areal Autocorrelation Function
.calculate_met_focal

Calculate Texture Metric for Single Pixel
fftshift

Fourier Transform Shift
area_above

Area Above the Bearing Area Curve
flatsa

Flattened Surface Area
height_ba

Value of the Bearing Area Curve at a Specified Value
orelevation

SRTM elevation for a portion of southwestern Oregon, USA.
fitplane

Calculate a Least Squares Polynomial Surface
findvalleys

Find Local Valleys
focal_metrics

Calculate Texture Metrics per Pixel
normforest

NDVI errors for a portion of southwestern Oregon, USA.
findpeaks

Find Local Peaks
find_flat

Finds the Flattest Part of the Bearing Area Curve