# NOT RUN {
## example with vector data:
data(eberg)
library(sp)
library(rgdal)
coordinates(eberg) <- ~X+Y
proj4string(eberg) <- CRS("+init=epsg:31467")
eberg.geo <- reproject(eberg)
# }
# NOT RUN {
## example with raster data:
data(eberg_grid25)
gridded(eberg_grid25) <- ~x+y
proj4string(eberg_grid25) <- CRS("+init=epsg:31467")
## reproject to geographical coords (can take few minutes!):
eberg_grid_ll <- reproject(eberg_grid25[1])
## much faster when using GDAL:
eberg_grid_ll2 <- reproject(eberg_grid25[1], program = "GDAL")
## optional: compare processing times:
system.time(eberg_grid_ll <- reproject(eberg_grid25[1]))
system.time(eberg_grid_ll2 <- reproject(eberg_grid25[1], program="GDAL"))
# }
Run the code above in your browser using DataLab