```r
frags<-rmapshaper::ms_simplify(grass_frags, keep = 0.02,keep_shapes = TRUE)
dist_mat<-st_distance(frags)
dist_mat<-drop_units(dist_mat)
#grass_frags %>% filter(area> 50000) ->dd
centers <- st_centroid(frags)
```

```
## Warning in st_centroid.sf(frags): st_centroid assumes attributes are
## constant over geometries of x
```

```r
coords<-st_coordinates(centers)
```