I'm trying to buffer the points in my dataset with a radius of 100km. I'm using the function gBuffer
from the package rgeos
. Here's what I have so far:
head( sampledf )
# postalcode lat lon city province
#1 A0A0A0 47.05564 -53.20198 Gander NL
#4 A0A1C0 47.31741 -52.81218 St. John's NL
coordinates( sampledf ) <- c( "lon", "lat" )
proj4string( sampledf ) <- CRS( "+proj=longlat +datum=WGS84" )
distInMeters <- 1000
pc100km <- gBuffer( sampledf, width=100*distInMeters, byid=TRUE )
I get the following warning:
In gBuffer(sampledf, width = 100 * distInMeters, byid = TRUE) : Spatial object is not projected; GEOS expects planar coordinates
From what I understand/read, I need to change the Coordinate Reference System (CRS), in particular the projection, of the dataset from 'geographic' to 'projected'. I'm not sure sure how to change this. These are all Canadian addresses, I might add. So NAD83 seems to me a natural projection to choose but I may be wrong.
Any/all help would be greatly appreciated.
See Question&Answers more detail:os