simplify_shape

0th

Percentile

Simplify shape

Simplify a shape consisting of polygons or lines. The number of coordinates are reduced.

Usage
simplify_shape(shp, fact = 0.1, keep.units = FALSE, keep.subunits = FALSE, ...)
Arguments
shp
a SpatialPolygons(DataFrame) or a SpatialLines(DataFrame), or a sf object that can be coerced to one of them.
fact
simplification factor, number between 0 and 1 (default is 0.1)
keep.units
d
keep.subunits
d
...
other arguments passed on to the underlying function ms_simplify (except for the arguments input, keep, keep_shapes and explode)
Details

This function is a wrapper of ms_simplify. In addition, the data is preserved. Also sf objects are supported.

Value

shape in the smae class as shp

Aliases
  • simplify_shape
Examples
## Not run: 
# if (require(tmap)) {
#     data(Europe)
# 
#     # show different simplification factors
#     tm1 <- qtm(Europe %>% simplify_map(fact = 0.05), title="Simplify 0.05")
#     tm2 <- qtm(Europe %>% simplify_map(fact = 0.1), title="Simplify 0.1")
#     tm3 <- qtm(Europe %>% simplify_map(fact = 0.2), title="Simplify 0.2")
#     tm4 <- qtm(Europe %>% simplify_map(fact = 0.5), title="Simplify 0.5")
#     tmap_arrange(tm1, tm2, tm3, tm4)
# 
#     # show different options for keeping smaller (sub)units
#     tm5 <- qtm(Europe %>% simplify_map(keep.units = TRUE, keep.subunits = TRUE),
#         title="Keep units and subunits")
#     tm6 <- qtm(Europe %>% simplify_map(keep.units = TRUE, keep.subunits = FALSE),
#         title="Keep units, ignore small subunits")
#     tm7 <- qtm(Europe %>% simplify_map(keep.units = FALSE),
#         title="Ignore small units and subunits")
#     tmap_arrange(tm5, tm6, tm7)
# }
# ## End(Not run)
Documentation reproduced from package tmaptools, version 1.0, License: GPL-3

Community examples

Looks like there are no examples yet.