Learn R Programming

GEOmap (version 2.5-11)

GETXprofile: Cross sectional profile through a digital elevation map

Description

Example of how to use RPMG button functions. This example shows how to plot a DEM and interactively change the plot and find projected cross-sections through a surface.

Usage

GETXprofile(jx, jy, jz, LAB = "A", myloc = NULL, PLOT = FALSE, NEWDEV=TRUE,  asp=1)

Value

Returns a list of x,z values representing the projected values along the cross section.

RX

distance along cross section

RZ

values extracted from the elevation map

Arguments

jx, jy

locations of grid lines at which the values in 'jz' are measured.

jz

a matrix containing the values to be plotted

LAB

Alphanumeric (A-Z) for labeling a cross section

myloc

Out put of Locator function

PLOT

logical. Plot is created if TRUE

NEWDEV

logical. Plot is on a new device if TRUE

asp

aspect ration for plotting, see par

Author

Jonathan M. Lees<jonathan.lees@unc.edu>

Details

The program uses a similar input format as image or contour, with structure from the locator() function of x and y coordinates that determine where the cross section is to be extracted.

See Also

locator, image

Examples

Run this code

if (FALSE) { 
#######  get data 
   data(volcano)
####  extract dimensions of image
   nx = dim(volcano)[1]
   ny = dim(volcano)[2]

###  establish units of image
   jx = 10*seq(from=0, to=nx-1)
   jy = 10*seq(from=0, to=ny-1)

####  set a letter for the cross section
   LAB = LETTERS[1]

###  coordinates of cross section on image
###  this is normally set by using the locator() function
   x1 = 76.47351
   y1 = 231.89055
   x2 = 739.99746
   y2 = 464.08185

## extract and plot cross section

 GETXprofile(jx, jy, volcano, myloc=list(x=c(x1, x2), y=c(y1, y2)), LAB=LAB, PLOT=TRUE)
            }

Run the code above in your browser using DataLab