Learn R Programming

ExtractTrainData (version 9.1.6)

ExtractByPoly: Add a Polygon shapefile and raster image.

Description

Add a Polygon shapefile and raster image.

Usage

ExtractByPoly(img, poly.shp, In.colName, Out.colName)

Arguments

img

Raster image

poly.shp

Polygon shapefile with class info

In.colName

Name of the column contain polygon id's

Out.colName

Name of the output column contain polygon id's

Author

Subhadip Datta

Examples

Run this code
library(raster)
library(ExtractTrainData)
img<-brick(system.file("extdata","ras.tif",package = "ExtractTrainData"))
poly.shp<-shapefile(system.file("extdata","poly_shp.shp",package = "ExtractTrainData"))
Out.colName<-In.colName<-"Id"

ExtractByPoly(img,poly.shp,In.colName,Out.colName)

Run the code above in your browser using DataLab