warning: Parameter 2 to gmap_gmap() expected to be a reference, value given in /home/spatiala/public_html/book/includes/module.inc on line 497.

Geomorphological units (fishcamp)

Short title: 
Purpose and use: 
Pre-processing of elevation data, extraction of landform units and predictive mapping of soil mapping units;
Programming environment: 
R / S language
Status of work: 
Tested on a MS Windows machine only
AttachmentSizeHitsLast download
fishcamp.R16.41 KB12863 days 5 hours ago


Changes in saga_cmd API indicates some adaptations

I am trying to reproduce script fishcamp.R with R-2.12.1, SAGA GIS 2.0.6 and RSAGA 0.91-1 on a FreeBSD 9.0-CURRENT (amd64) system. Most commands work well. But it seems, that the saga_cmd API changed a bit. This implicates some renaming in particular for rsaga.geoprocessor parameters.

For example instead of

rsaga.geoprocessor(lib="grid_gridding", module=0, 
             INPUT="lidar.shp", FIELD=0, LINE_TYPE=0, USER_CELL_SIZE=pixelsize, 
             USER_X_EXTENT_MIN=grids5m@bbox[1,1]+pixelsize/2, USER_X_EXTENT_MAX=grids5m@bbox[1,2]-pixelsize/2, 
             USER_Y_EXTENT_MIN=grids5m@bbox[2,1]+pixelsize/2, USER_Y_EXTENT_MAX=grids5m@bbox[2,2]-pixelsize/2))

I have to write

rsaga.geoprocessor(lib="grid_gridding", module=0, 
  param=list(INPUT="lidar.shp", FIELD=0, LINE_TYPE=0, USER_SIZE=pixelsize, 
             USER_XMIN=grids5m@bbox[1,1]+pixelsize/2, USER_XMAX=grids5m@bbox[1,2]-pixelsize/2, 
             USER_YMIN=grids5m@bbox[2,1]+pixelsize/2, USER_YMAX=grids5m@bbox[2,2]-pixelsize/2, 

Resampling 'DEM5LIDARf.sgrd' to 25m cellsize does not work as expected (line 124). After renaming some params and successfull processing the new grid file 'DEM25LIDAR.sgrd' has 25m cellsize, but origin and coordinate system of this grid are slightly relocated against 'DEM25TPS[f].sgrd' (81x 41y instead of 80x 40y and 267999x 4148999y instead of 268001.5x 4149001.5y) and the number of cells is 3201 instead of 3200.

Adding two more parameters seems to solve this (USER_XMIN and USER_YMIN). I am not sure about why and how to use 'METHOD=2':

rsaga.geoprocessor(lib="grid_tools", module=0, 
             USER_XMIN=grids5m@bbox[1,1]+pixelsize/2, USER_YMIN=grids5m@bbox[2,1]+pixelsize/2, 
             USER_SIZE=25, USER_GRID="DEM25LIDAR.sgrd", GRID_GRID="DEM25LIDAR.sgrd"))

With this grid I get the following difference between the LiDAR DEM and topo DEM (instead of 5.398652)

sqrt(sum((grids25m$DEM25LIDAR - grids25m$DEM25TPS)^2)/length(grids25m$DEM25LIDAR))
[1] 5.509092

I would appreciate some hints about using grid_tools in this context.

Thanks in advance,
Rainer Hurling