Learn R Programming

ASIP (version 0.4.9)

crop.bands: Cropping of satellite image bands

Description

Crop desired satellite image bands either using a shapefile or draw custom extent from a plot image while running the function.

Usage

crop.bands(directory = getwd(), crop = "n", ext2crop = "none",
  op_directory = directory, b1 = 1, b2 = 1, b3 = 1, b4 = 1, b5 = 1,
  b6 = 1, b7 = 1)

Arguments

ext2crop, crop, directory

Same as mentioned in arvi.

op_directory

Specify the output directory (within double quotes). By default the input satellite image directory will be selected as the output directory.

b1

By default Band1 will be cropped. To cancel cropping of this band assign value 0.

b2

By default Band2 will be cropped. To cancel cropping of this band assign value 0.

b3

By default Band3 will be cropped. To cancel cropping of this band assign value 0.

b4

By default Band4 will be cropped. To cancel cropping of this band assign value 0.

b5

By default Band5 will be cropped. To cancel cropping of this band assign value 0.

b6

By default Band6 will be cropped. To cancel cropping of this band assign value 0.

b7

By default Band7 will be cropped. To cancel cropping of this band assign value 0.

Value

Each bands selected will cropped and produce corresponding <bandname>_crop.tif format in the input directory.

Examples

Run this code
# NOT RUN {
library (raster)
library (rgdal)
# Finding the path of the sample satellite image directory.
# User may define paths directly like "/home/ur_folder" or "C:/ur_folder"
path <- system.file ("TM_sample", package = "ASIP")
shapefil <- paste0 (path, "/test.shp")
# Assign 0 values to band names which are not required
crop.bands (path, crop = "f", ext2crop = shapefil, b3=0, b4=0, b5=0, b6 = 0, b7 = 0)
# }

Run the code above in your browser using DataLab