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)

1 Answer 1


Don't use byid=TRUE when buffering. byid=TRUE creates a buffer for each row in the data frame. With byid=FALSE the function creates a single buffer polygon. Try plotting it to see what happens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.