library(rgdal) library(sf) library(sp) library(rgdal) library(dplyr) setwd("") Selection<-st_read("./Footprints_county_sample.shp") st_crs(Selection) Footprints_c<-st_centroid(Selection) # 500 meter buffer Footprints_500_m<-st_buffer(Footprints_c, 500) Intersections<-st_read("./Intersections.shp") Intersections$Intersections<-1 Intersections<-Intersections[c('Intersections')] Intersections<-st_transform(Intersections, st_crs(Footprints_500_m)) Intersections<-Intersections[c('index','buffer', 'Intersections')] Intersections<-Intersections %>% group_by(index, buffer) %>% summarise(across(everything(), sum)) write.csv(Intersections, "Intersections.csv")