Dear list,
I am using R 3.1.2 on Ubuntu 14 with SAGA GIS 2.1.1 and RSAGA 0.93-6.
I have a SRTM derived DEM called DEM.tif which I want to use with SAGA from R.
I do:
library(raster)
library(rgdal)
library(sp)
library(RSAGA)
work_env <- rsaga.env(modules="/usr/local/lib/saga/")
rsaga.import.gdal("source/DEM.tif", env=work_env)
Now I want to check the converted file, so I do:
result <- raster("source/DEM.sdat")
plot(result)
DEM <- raster("source/DEM.tif")
plot(DEM)
The original DEM is plotted like this:
[X]
The resulting DEM is plotted like this:
[X]
How does this happen? The projection and cellsize seem lost, and it is turned upside down.
When I open the file in SAGA GIS it looks the same but it says it has the right projection (WGS 84, epsg 4326). I can also open the tif file in SAGA which seems alright.
I had this problem before with other versions too.
Kind regards,
Bouke Pieter Ottow
rsaga.import.gdal gives weird output
2 messages · Ottow, Bouke Pieter, boukepieter
4 days later
Dear list, For the record; I found a workaround for the mentioned issue. It seems that when changing the file from tiff to sdat something goes wrong in the transformation. In the 'GDAL: import raster' tool of SAGA there is an option to turn transformation on and choose what method to use. This tool can also be accessed from R with:
rsaga.geoprocessor(lib="io_gdal", module=0, param=list(GRIDS=paste(getwd(),"RSAGA/Rtest.sgrd",sep="/"),
FILES=paste(getwd(),"source/DEM.tif",sep="/"),
TRANSFORM=TRUE,
INTERPOL=1))
And this gives the right result with the same data.
Regards,
Bouke Pieter Ottow
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/rsaga-import-gdal-gives-weird-output-tp7587402p7587427.html
Sent from the R-sig-geo mailing list archive at Nabble.com.