For visualizing, it is sometimes useful to remove points in Spatial* objects. This will change the geometry, so it is not recommended for computation. This is similar to sf::st_simplify, but faster (see examples) for large shapefiles, particularly if returnDataFrame is TRUE. thin will not attempt to preserve topology. It is strictly for making smaller polygons for the (likely) purpose of visualizing more quickly.

thin(
  x,
  tolerance,
  returnDataFrame,
  minCoordsToThin,
  ...,
  verbose = getOption("quickPlot.verbose")
)

thnSpatialPolygons(
  x,
  tolerance = NULL,
  returnDataFrame = FALSE,
  minCoordsToThin = 1e+05,
  maxNumPolygons = getOption("quickPlot.maxNumPolygons", 3000),
  ...,
  verbose = getOption("quickPlot.verbose")
)

# S3 method for default
thin(
  x,
  tolerance,
  returnDataFrame,
  minCoordsToThin,
  maxNumPolygons,
  ...,
  verbose = getOption("quickPlot.verbose")
)

Arguments

x

A Spatial* object

tolerance

Maximum allowable distance for a point to be removed.

returnDataFrame

If TRUE, this will return a list of 3 elements, xyOrd, hole, and idLength. If FALSE (default), it will return a SpatialPolygons object.

minCoordsToThin

If the number of coordinates is smaller than this number, then thin will just pass through, though it will take the time required to calculate how many points there are (which is not NROW(coordinates(x)) for a SpatialPolygon)

...

Passed to methods (e.g., maxNumPolygons)

verbose

Numeric or logical. If TRUE or >0, then messages will be shown. If FALSE or 0, most messages will be suppressed.

maxNumPolygons

For speed, thin can also simply remove some of the polygons. This is likely only a reasonable thing to do if there are a lot of polygons being plotted in a small space. Current default is taken from options('quickPlot.maxNumPolygons'), with a message.