Session Ready
Exercise

Compute a convex hull around vectors

A more precise bounding polygon is sometimes needed, one that fits your data more neatly. For this, you can use the st_convex_hull() function. Note that st_convex_hull() will compute a tight box around each one of your features individually so if you want to create a convex hull around a group of features you'll need to use st_union() to combine individual features into a single multi-feature.

Instructions
100 XP
  • Use head() on beech to look at the data frame and see the type of geometry.
  • Use st_union() to combine the individual points in the beech object into a single MULTIPOINT geometry and call this beech1.
  • Use head() on beech1 to see the type of geometry of the dissolved object.
  • Use the length() function from base R on beech and beech1 to confirm that the number of features went from 17 to 1.
  • Use the st_convex_hull() function on beech1 to compute the tight bounding box around the beech trees and call this beech_hull.
  • Plot beech_hull and then plot the points on top. Use plot() twice and run the lines together.