Interactive maps with mapview (1)

st_sample() samples points on spatial features, and returns an sfc class

However mapview needs an sf object. To upgrade sfc to sf we use st_as_sf().

nc_points <- st_sample(nc, size = 10) |> st_as_sf() 
## Warning in st_poly_sample(x, size = size, ..., type = type, by_polygon =
## by_polygon, : coordinate ranges not computed along great circles; install
## package lwgeom to get rid of this warning