thinnedSpatialPoly {Guerry} | R Documentation |
The function "thins" a SpatialPolygons
or SpatialPolygonsDataFrame
object,
by reducing the number of points required to represent each line in the spatial
polygons defining the map.
For map-based graphics using complex maps (such as gfrance
)
and rendered using vector graphics devices (pdf, postscript), thinning the
base map can vastly reduce the size of the resulting graphic output files.
thinnedSpatialPoly(SP, tolerance, minarea=0)
SP |
A SpatialPolygons or SpatialPolygonsDataFrame object |
tolerance |
tolerance used by the dp function.
The scale used for tolerance corresponds to the range of map coordinates, but
is not documented precisely. If not supplied, the function uses the minimum range
of the bounding box of the map / 100.
|
minarea |
The minimum area of polygons to keep in the resulting object. The default,
minarea=0 means that all polygons, even tiny bits and slivers are retained.
Typically, you will want to set this to something larger.
|
Returns an object of the same class as the input, SP
.
The dp
function used here is not topology-preserving
and may create visual artifacts (slivers, overlapping boundaries).
Roger Bivand, packaged by Michael Friendly
Douglas, D. and Peucker, T. (1973). Algorithms for the reduction of the number of points required to represent a digitized line or its caricature. The Canadian Cartographer, 10(2). 112-122
object.size(gfrance) ## not run, because shapefiles::dp uses T and F, causing R CMD check to fail ## Not run: gfrance_dp <- thinnedSpatialPoly(gfrance, tolerance=2500, minarea=500000) object.size(gfrance_dp) ## End(Not run)