[R-sig-Geo] saga grid format TOPTOBOTTOM

Chuck Bulmer cebulmer at telus.net
Mon May 20 18:46:14 CEST 2013


Hi all.

I am using package raster to crop some saga grids with a shapefile.

The original inut sgrd file looks like this:

NAME	= ELEV_1HA
DESCRIPTION	= 
UNIT	= 
DATAFILE_OFFSET	= 0
DATAFORMAT	= FLOAT
BYTEORDER_BIG	= FALSE
POSITION_XMIN	= 321888.3470000000
POSITION_YMIN	= 376291.6470000000
CELLCOUNT_X	= 15358
CELLCOUNT_Y	= 13473
CELLSIZE	= 100.0000000000
Z_FACTOR	= 1.000000
NODATA_VALUE	= -9999.000000
TOPTOBOTTOM	= FALSE

After using the (below) code, the output sgrd file looks like this:

NAME	= ELEV_1HA 
DESCRIPTION	= 
UNIT	= 
DATAFORMAT	= FLOAT 
DATAFILE_OFFSET	= 0
BYTEORDER_BIG	= FALSE 
POSITION_XMIN	=  1427688.347 
POSITION_YMIN	=  486091.647 
CELLCOUNT_Y	=  1685 
CELLCOUNT_X	=  784 
CELLSIZE	=  100 
Z_FACTOR	= 1.000000
NODATA_VALUE	= -3.4e+38 
TOPTOBOTTOM	= TRUE 

The resulting files are read by SAGA-GIS with no problem and they look good,
but I want to use Quantum GIS as my map viewer and when I try to load the
result file into QGIS it provides me with the following error:
"..ELEV_1HA is not a supported data source. Currently the Saga Binary Grid
driver does not support Saga Grids written TOPTOBOTTOM"

If I load and resave the grid with SAGA, TOPTOBOTTOM reverts back to FALSE,
and the grid can be read by QGIS, but I'd like to avoid this extra step.

Is there a way to add a setting to the crop function? raster? gdal? to write
as TOPTOBOTTOM=FALSE, which would save me the extra step of loading and
resaving each grod.

Thanks for any help you can provide

Chuck

Here's the code ... (Windows 7x64)

s <- raster("D:\\BC_DSM\\ELEV_1HA.sdat")
t<- shapefile("D:\\BC_DSM\\ecodistrict_bdy_b10k.shp")
crop(s,t,filename="D:\\BC_DSM\\Results\\ELEV_1HA.sdat")





--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/saga-grid-format-TOPTOBOTTOM-tp7583610.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list