5.3 Simplifying Polygons

# original data
us_states2163 = st_transform(us_states, "EPSG:2163")
us_states2163 |>
  ggplot() +
  geom_sf() +
  labs(title = "United States",
       subtitle = "continental United States",
       caption = "GeoComputation with R book club") +
  theme_minimal()

us_states2163_simp_1 = st_simplify(us_states2163, 
                                   dTolerance = 1e3)  #1 kilometer
us_states2163_simp_1 |>
  ggplot() +
  geom_sf() +
  labs(title = "United States",
       subtitle = "resolution: 1 kilometer",
       caption = "GeoComputation with R book club") +
  theme_minimal()

object.size(us_states2163)
## 113576 bytes
object.size(us_states2163_simp_1)
## 106136 bytes
object.size(us_states2163_simp_10)
## 68008 bytes
object.size(us_states2163_simp_100)
## 53224 bytes

5.3.1 smoother algorithms

The smoother package offers other ways to simplify the data.

  • st_simplify (Douglas-Peucker)
  • ms_simplify (Visalingam)
  • smooth(method = ksmooth) (Gaussian kernel regression with parameter smoothness)