# class_geocontainer_methods.R
#' @include internals.R
#' @rdname class_geocontainer_methods
#' @template class_geocontainer_methods
#' @aliases as_spatial_points
#' @export
methods::setGeneric("as_spatial_points", function(x, ...)
{
standardGeneric("as_spatial_points")
})
#' @rdname class_geocontainer_methods
#' @export
methods::setGeneric("as_spatial_points_data_frame", function(x, ...)
{
standardGeneric("as_spatial_points_data_frame")
})
#' @rdname class_geocontainer_methods
#' @export
methods::setMethod("as_spatial_points",
signature = signature(x = "GeoContainer"),
definition = function(x)
{
return(sp::SpatialPoints(xy(x), crs(x)))
})
#' @rdname class_geocontainer_methods
#' @export
methods::setMethod("as_spatial_points_data_frame",
signature = signature(x = "GeoContainer"),
definition = function(x)
{
return(sp::SpatialPointsDataFrame(xy(x), table(x), numeric(), crs(x)))
})
setAs(
from = "GeoContainer",
to = "SpatialPoints",
def = function(from)
{
return(as_spatial_points(from))
})
setAs(
from = "GeoContainer",
to = "SpatialPointsDataFrame",
def = function(from)
{
return(as_spatial_points_data_frame(from))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.