Haskell Library to wrap saga_cmd
.
Three exectuables are currently shipped
- sagaPipe
- A program to chain different saga-calls, where the output of one command gets the input of the next.
- sagaTopo
- Wrapper to create topographic-maps out of
sgrid
-filesFor example
sagaTopo --min 280 --max 360 -o dem.tif dem.sgrd
- sagaLut
- Program to create color lookup-tables with min/max values
eg
sagaLut 260 280 > colors.txt
This is Work In Progress.
Command | (cmdPar,sagaPar,default) | sagaLib | sagaModule | defaultSuffix |
---|---|---|---|---|
ascGrd | NA | io_grid | 1 | .sgrd |
gdalGrid | NA | io_gdal | 0 | .sgrd |
gridClassToPoly | (all,CLASS_ALL,1):(id,CLASS_ID,1):(split,SPLIT,0) | shapes_grid | 6 | _polygons.shp |
gridClassifyFlat | (method,METHOD,0):(new,NEW,1.0):(nodata,RESULT_NODATA_VALUE,-99999.0):(old,OLD,0.0):(table,RETAB,reclassify.txt) | grid_tools | 15 | _reclassified.sgrd |
gridContour | (d,ZSTEP,1):(max,ZMAX,10000):(min,ZMIN,0) | shapes_grid | 5 | _contour.shp |
gridEsriAsc | NA | io_grid | 0 | .asc |
gridFillGaps | NA | grid_tools | 25 | _filled.sgrd |
gridFillGapsSpline | (grdFlT,TARGET_DEFINITION,1) | grid_spline | 5 | _filled.sgrd |
gridHillshade | NA | ta_lighting | 0 | _hillshade.sgrd |
gridPolyClip | (poly,POLYGONS,1) | shapes_grid | 7 | _polyClip.sgrd |
gridSlope | (aspect,ASPECT,aspect) | ta_morphometry | 0 | _slope.sgrd |
gridTifGdal | NA | io_gdal | 2 | .tif |
gridTifHillshade | (colRev,COL_REVERT,1):(max,STRETCH_MAX,1.571):(min,STRETCH_MIN,0):(pal,COL_PALETTE,2) | io_grid_image | 0 | .tif |
gridTifTerrain | (col,COLOURING,2):(max,STRETCH_MAX,100):(min,STRETCH_MIN,0):(pal,COL_PALETTE,23) | io_grid_image | 0 | .tif |
gridXyz | (header,CAPTION,0):(na,EX_NODATA,1) | io_grid | 5 | .xyz |
lasToPtCld | NA | io_shapes_las | 1 | .spc |
polyDissolve | (f1,FIELD_1,1):(f2,FIELD_1,-1):(f3,FIELD_1,-1):(method,DISSOLVE,0) | shapes_polygons | 5 | _disollved.shp |
ptCldToGrid | (cs,CELLSIZE,1) | pointcloud_tools | 4 | .sgrd |
xyzGridToGrid | (cs,CELLSIZE,1):(sep,SEPARATOR,space) | io_grid | 6 | .sgrd |
sudo aptitude install haskell-platform
sudo aptitude install saga
- Get the haskell-platform
- Install Saga with OSGeo4W
- Put
saga_cmd
in the search path; add the line following (the actual filepath could differ) line to your$HOME/.bashrc
export PATH="$PATH:/cygdrive/c/Program Files (x86)/SAGA-GIS
git clone https://www.github.com/michelk/bindings-saga-cmd.hs.git
cd bindings-saga-cmd.hs
stack install
The exectuables are usually installed into $HOME/.cabal/bin
; to
use them you have to put them into your search path. Put this into
your $HOME/.bashrc
:
export PATH="$PATH:$HOME/.local/bin"
$HOME/.local/bin/sagaPipe --help
sagaPipe
lets you chain saga_cmd
commands. The program could be
used in two ways. Common for both modes are specification of
parameters to use during conversion and the input-file.
- Source-Target
- Specify a source-format and target-format
- Processing-pathway
- Specify pathway/route to go exlicitly
The pathways are visualized below
sagaPipe \
--from xyz-grid \
--to grid-filled-hillshade-tif \
--parameters sep=tabulator:cs=0.5 \
-o dem_hillshade.tif \
dem.xyz
If -o
hadn’t been specified, in the directory of the input-file, the follwing grids would have been created:
dem_grid.sgrd
dem_grid-filled.sgrd
dem_grid-filled_hillshade.sgrd
The equivalent exlicit version to above is
sagaPipe --chain xyzGridToGrid:gridFillGaps:gridHillshade --parameters sep=tabulator:cs=0.5 dem.xyz
Or for example If you would like to create a hillshade with some buildings removed; invert the buildings-shapefile and do the following
sagaPipe --chain xyzGridToGrid:gridFillGaps:gridHillshade:gridPolyClip:gridTifHillshade \
-p poly=BuildingsInv.shp:cs=0.5:sep=tabulator dem.xyz
Wrapper-program to create topographic maps from sgrd
-files
In order to extend functionality, the follwing steps are necessary
- Find the wanted library and module
- Eg with
./doc/search
- Eg with
- Edit
src/Math/Geometry/Saga/Data.hs
- create a SagaCmd (copy & paste an existing one; pretty straigt forward)
- create a pathway-chain
- Export
README.org
cd doc
./search <keyword>
Edit src/Math/Geometry/Saga/Data.hs
- Add Module
- Add pathway node
- Edit
README.org
- extend library-commands
- merge
sagaTopo
intosagaPipe
- cmd-line-option which color-palette to use (
sagaLut
)