0

I downloaded a digital elevation data set. The file is '.tif' format. I have loaded in R. But when I try to transform the coordinate reference system from long/latitude to local UTM, problems occur. The code and errors are presented as below.

dem=raster('srtm_58_04.tif')
proj4string(dem)="+proj=longlat +ellps=GRS80 +no_defs"
myproj="+proj=utm +zone=48 +north +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"
library(rgdal)
datutm=spTransform(dem,CRS(myproj))

Error in spTransform(dem, CRS(myproj)) : 
  load package rgdal for spTransform methods

How can I solve this problem?

Jeffrey Bosboom
  • 13,313
  • 16
  • 79
  • 92
  • 1
    Please add some formatting to your question. – Jost Feb 07 '15 at 11:49
  • Use [`raster::projectRaster()`](http://www.inside-r.org/packages/cran/raster/docs/projectRaster) or (not in R) [gdalwarp](http://www.gdal.org/gdalwarp.html) to transform raster. – EDi Feb 07 '15 at 20:55

1 Answers1

0

Use raster::projectRaster() or (not in R) gdalwarp to transform raster.

EDi
  • 13,160
  • 2
  • 48
  • 57