R/df-spatial-sp.R

Defines functions df_spatial.Spatial

#' @export
df_spatial.Spatial <- function(x, ...) {
  if ("data" %in% methods::slotNames(x)) {
    # a Spatial*DataFrame
    df_spatial(sf::st_as_sf(x))
  } else {
    # a Spatial*
    df_spatial(sf::st_as_sfc(x))
  }
}

Try the ggspatial package in your browser

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

ggspatial documentation built on Aug. 17, 2023, 5:13 p.m.