I am taking occurrence point data (in the form of individual Lat/Long points), and adding a 1km buffer around them using gBuffer()
in R package rgeos
.
I'm then using the function gArea()
to calculate the total area of the generated shapefiles. However, the result is the sum of each polygon's area, such that overlapping polygons are counted multiple times.
What I am hoping to get is only the total area of their footprint (essentially equivalent to a dissolved shapefile in ArcGIS).
Because I need to do this process for over 120 species, I'm looking for an automated approach in R rather than manually dissolving the shapefiles in ArcGIS.
# Generate 1km point buffers. Projected CRS for function: USA Contiguous albers equal area
geodata_Albers <- spTransform(dat_sp, crs.albers)
# Create 1 km buffer and add the total area to the AOOs dataframe.
sp_buffer_1km <- gBuffer(geodata_Albers, width = 1, byid= TRUE)
AOOs[i,]$buffer_1km <- gArea(sp_buffer_1km, byid = FALSE)