8

I have this polygon:

library(maptools); library(sp)
setwd(system.file("shapes", package="maptools")) 
columbus <- readShapeSpatial("columbus.shp")

proj4string(columbus) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
columbus <- spTransform(columbus, CRS("+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"))

I need to buffer 1km around the polygon, so I tried this:

library(rgeos)
gBuffer(columbus, width = 1000)

Could someone tell me if buffering by width=1000 is buffering by 1km?

1
  • Yes your map projection is in units of metres. – mdsumner Feb 4 '14 at 12:08
7

It depends on the units. If you are using metric system (like UTM), than 1000 is indeed 1 km. If the units are in WGS (degrees), than you have to first convert your data to metric system (spTranspform in rgdal package) and then you can use gBuffer with 1000 width.

Columbus data are in WGS (you can see it by the fact, that coordinates are around 9 or 10).

Therefore you have to transforms them. I am not sure, which CRS you use, but it seems to be metric, so in that case, width 1000 equal to 1 km.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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