future_simplify: Parallel implementation of 'rmapshaper::ms_simplify'

View source: R/future_simplify.R

future_simplifyR Documentation

Parallel implementation of rmapshaper::ms_simplify

Description

simply splits up an sf and runs the simplify algorithm on each chunk. Uses mapshaper to simplify polygons. Currently only supports sf objects.

Usage

future_simplify(
  x,
  keep = 0.05,
  method = NULL,
  weighting = 0.7,
  keep_shapes = FALSE,
  no_repair = FALSE,
  snap = TRUE,
  explode = FALSE,
  drop_null_geometries = TRUE,
  snap_interval = NULL,
  nchunks = 1,
  .progress = FALSE
)

Arguments

x

spatial object to simplify. One of:

  • sf or sfc polygons or lines object

keep

proportion of points to retain (0-1; default 0.05)

method

simplification method to use: "vis" for Visvalingam algorithm, or "dp" for Douglas-Peuker algorithm. If left as NULL (default), uses Visvalingam simplification but modifies the area metric by underweighting the effective area of points at the vertex of more acute angles, resulting in a smoother appearance. See this https://github.com/mbloch/mapshaper/wiki/Simplification-Tipslink for more information.

weighting

Coefficient for weighting Visvalingam simplification (default is 0.7). Higher values produce smoother output. weighting=0 is equivalent to unweighted Visvalingam simplification.

keep_shapes

Prevent small polygon features from disappearing at high simplification (default FALSE)

no_repair

disable intersection repair after simplification (default FALSE).

snap

Snap together vertices within a small distance threshold to fix small coordinate misalignment in adjacent polygons. Default TRUE.

explode

Should multipart polygons be converted to singlepart polygons? This prevents small shapes from disappearing during simplification if keep_shapes = TRUE. Default FALSE

drop_null_geometries

should Features with null geometries be dropped? Ignored for Spatial* objects, as it is always TRUE.

snap_interval

Specify snapping distance in source units, must be a numeric. Default NULL

nchunks

The number of chunks to run on each core. Default is 1. Can improve or worsen performance depending on dataset size and number of cores

.progress

Show progress bar. Only useful when nchunks > 1. default is FALSE

Value

a simplified representation of the geometry in the same class as the input


h-a-graham/sfurrr documentation built on June 3, 2023, 10:14 p.m.