cutSatin: Cut an area of interest from satellite images

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/cutSatin.r

Description

Select and cut a polygon shaped area of interest (aoi) from satellite images

Usage

1
cutSatin(satin.obj, polygon = NULL, return.poly = FALSE)

Arguments

satin.obj

a satin object as returned by read.oceancolor

polygon

a polygon defining the aoi to be cut

return.poly

if TRUE cutSatin returns a list with two elements: an object class satin and an object class data.frame (polygon), otherwise an object class satin only

Details

If provided, the polygon defining the aoi must have two columns with x and y coordinates. The function assures that the last point is exactly the same as the first one. When not specified, the user can define the polygon by a series of clicks on the previously displayed image. The result is a list containing the polygon and a “satin” object with the same dimensions as the original, but where the pixels outside the aoi are set to NA.

Value

An object of class “satin” as returned by read.oceancolor.

When return.poly = TRUE, a list with two components:

aoi

“satin” object

polygon

polygon coordinates defining the aoi

Author(s)

Héctor Villalobos

See Also

read.oceancolor, getpoly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# load and display sample data
data(dbsst)
plotSatin(dbsst)
  
# define polygon, cut the image and display the aoi
polyg <- data.frame(x = c(-125, -126, -120, -119, -125), y = c(35, 30, 28, 34, 35))
dbsst.cut <- cutSatin(dbsst, polygon = polyg)
plotSatin(dbsst.cut)

## Not run:  

# the same, but polygon is defined by clicking on the image
plotSatin(dbsst)
dbsst.cut <- cutSatin(dbsst, return.poly = TRUE) # *** draw the aoi polygon ***
dbsst.cut$polygon # show polygon coordinates
plotSatin(dbsst.cut$aoi) # plot the selected aoi

## End(Not run)

r-forge/satin documentation built on Feb. 18, 2022, 2:39 a.m.