R/ds.over.R

Defines functions ds.over

Documented in ds.over

#' @title Wrapper for \code{over()} function from sp and rgeos packages
#' @description This function is a wrapper for the \code{over()} function from the
#' sp and rgeos packages
#' @details See the \code{over()} function from rgeos package for more details
#' @param input_x name of a spatial object on the server side to which the over will be applied
#' @param input_y name of a spatial object on the server side to which the over will be applied
#' @param retList something to do with lists
#' @param fun something to do with lists
#' @param newobj.name a character, the name of the new object which will be created
#' If no name is specified the default name is the name of the original data frame
#' followed by the suffix '.proj'.
#' @param datasources a list of opal object(s) obtained after login in to opal servers;
#' these objects hold also the data assign to R, as \code{dataframe}, from opal datasources.
#' @return an object of class SpatialPolygonsDataFrame or SpatialPolygons,
#' depending on the class of input
#' @author Bishop, T.
#' @export
#'
ds.over = function(input_x=NULL, input_y=NULL, retList = FALSE, fun = NULL,  newobj.name=NULL, datasources=NULL) {

  ##################################################################################
  # look for DS connections
  if(is.null(datasources)){
    datasources <- DSI::datashield.connections_find()
  }

  if(is.null(input_x)|is.null(input_y)){
    stop("Please provide the names of sp objects as defined in package sp!", call.=FALSE)
  }

  if(is.null(newobj.name)){
    newobj.name <- paste0(input_x,".over")
  }

  calltext <- call("overDS", input_x, input_y, retList, fun)
  DSI::datashield.assign(datasources, newobj.name, calltext)

}
tombisho/dsGeoClient documentation built on Sept. 16, 2021, 12:18 a.m.