R/intersection.r

#' Intersection area between two SAR records
#' 
#' Returns the intersection of borders (provided by metadata) as a \code{\link[sp]{SpatialPolygons}} object.
#' 
#' @param object object of the \code{\link{SAR-class}} or a subclass (e.g. \code{\link{Sentinel-class}} or \code{\link{TSX-class}}).
#' @param slave object of the \code{\link{SAR-class}} or a subclass (e.g. \code{\link{Sentinel-class}} or \code{\link{TSX-class}}).
#' @export
#' @return \code{\link[sp]{SpatialPolygons}}
setGeneric('intersection',
           function(object, slave) {
               standardGeneric('intersection')
           })

#' @rdname intersection
#' @export
setMethod('intersection', 'SAR', 
          function(object) {
              border(object)
          })

#' @rdname intersection
#' @export
setMethod('intersection', c('SAR', 'SAR'),
          function(object, slave) {
              intersect(border(object), border(slave))
          })

Try the ragram package in your browser

Any scripts or data that you put into this service are public.

ragram documentation built on May 2, 2019, 4:42 p.m.