diff --git a/R/utils.R b/R/utils.R index 0f11ae5..706dbfc 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,7 +1,7 @@ #' Apply a mapshaper command string to a geojson object #' -#' @param data geojson object or path to geojson file. If a file path, \code{sys} -#' must be true +#' @param data character containing geojson or path to geojson file. +#' If a file path, \code{sys} must be true. #' @param command valid mapshaper command string #' @param force_FC should the output be forced to be a FeatureCollection (or #' Spatial*DataFrame) even if there are no attributes? Default \code{TRUE}. @@ -16,6 +16,10 @@ #' #' @return geojson #' @export +#' @examples +#' +#' nc <- sf::read_sf(system.file("gpkg/nc.gpkg", package = "sf")) +#' rmapshaper::apply_mapshaper_commands(geojsonsf::sf_geojson(nc), "-clean") #' apply_mapshaper_commands <- function(data, command, force_FC = TRUE, sys = FALSE, sys_mem = 8) { diff --git a/man/apply_mapshaper_commands.Rd b/man/apply_mapshaper_commands.Rd index 85972bf..5e6de41 100644 --- a/man/apply_mapshaper_commands.Rd +++ b/man/apply_mapshaper_commands.Rd @@ -13,8 +13,8 @@ apply_mapshaper_commands( ) } \arguments{ -\item{data}{geojson object or path to geojson file. If a file path, \code{sys} -must be true} +\item{data}{character containing geojson or path to geojson file. +If a file path, \code{sys} must be true.} \item{command}{valid mapshaper command string} @@ -37,3 +37,9 @@ geojson \description{ Apply a mapshaper command string to a geojson object } +\examples{ + +nc <- sf::read_sf(system.file("gpkg/nc.gpkg", package = "sf")) +rmapshaper::apply_mapshaper_commands(geojsonsf::sf_geojson(nc), "-clean") + +}