ZOO-Project: service_internal_saga.c File Reference
ZOO-Project
service_internal_saga.c File Reference
#include <stdlib.h>
#include <limits.h>
#include <locale.h>
#include <wx/string.h>
#include <wx/app.h>
#include <api_core.h>
#include <data_manager.h>
#include <saga_api.h>
#include "service_internal_saga.h"
#include "server_internal.h"
#include "mimetypes.h"

Data Structures

class  SagaWatcher
 Observer used to access the ongoing status of a running OTB Application. More...
 

Macros

#define _ZOO_SAGA
 

Functions

TSG_PFNC_UI_Callback Get_Callback (SagaWatcher watcher)
 
const char * sagaGetDefaultExt (CSG_Parameter *param)
 Get the default file extension for SAGA-GIS parameter type. More...
 
bool sagaLoadInput (CSG_Parameter *param, map *arg)
 Load a datasource in the SAGA-GIS Data Manager. More...
 
bool sagaSetParameters (CSG_Parameters *params, map *argument)
 Extract all SAGA-GIS parameters from a parameters list and set its values to the one defined in the map. More...
 
bool sagaSaveOutputs (CSG_Parameters *params, maps *main_conf, maps **outputs)
 Save all values outputed by a SAGA-GIS module invocation to files. More...
 
int sagaExecuteCmd (maps **main_conf, const char *lib_name, const char *module_name, map *arguments, maps **outputs=NULL)
 Invoke the execution of a SAGA-GIS module. More...
 
int sagaExportOGR (maps **conf, maps **in)
 Export a SAGA-GIS Shapes to a file in a specific format (GML,KML,GeoJSON). More...
 
void sagaExportPC (maps **conf, maps **in)
 Export a SAGA-GIS pointcloud to a las file. More...
 
int sagaExportGDAL (maps **conf, maps **in)
 Export a SAGA-GIS Grid to a file in a specific format (tiff,hdr,aa). More...
 
int sagaExportTIN (maps **conf, maps **in, const char *tname)
 Export a SAGA-GIS TIN to a file in a specific format (GML,KML,GeoJSON). More...
 
int sagaImportGDAL (maps **conf, maps **in)
 Import GDAL Datasource into SAGA-GIS. More...
 
int sagaImportOGR (maps **conf, maps **in)
 Import OGR Datasource into SAGA-GIS. More...
 
bool sagaImportTIN (maps **conf, maps **in)
 Import TIN into SAGA-GIS. More...
 
int sagaImportTable (maps **conf, maps **in)
 Import table into SAGA-GIS. More...
 
int sagaImportPC (maps **conf, maps **in)
 Import las file as pointcloud into SAGA-GIS. More...
 
int zoo_saga_support (maps **main_conf, map *request, service *s, maps **inputs, maps **outputs)
 Load and invoke a SAGA-GIS module defined in a service metadata definitions. More...
 

Variables

int sagaOutputCounter =0
 Global SAGA-GIS output counter. More...
 

Macro Definition Documentation

#define _ZOO_SAGA

Function Documentation

TSG_PFNC_UI_Callback Get_Callback ( SagaWatcher  watcher)
int sagaExecuteCmd ( maps **  main_conf,
const char *  lib_name,
const char *  module_name,
map arguments,
maps **  outputs = NULL 
)

Invoke the execution of a SAGA-GIS module.

Parameters
main_confthe conf maps containing the main.cfg settings
lib_namethe SAGA-GIS library name
module_namethe SAGA-GIS module name
argumentsthe map containing the arguments to pass to the module
outputsdefault to NULL, contains the maps to fill with the result
int sagaExportGDAL ( maps **  conf,
maps **  in 
)

Export a SAGA-GIS Grid to a file in a specific format (tiff,hdr,aa).

saga_cmd io_gdal 1 -FILE my.format -GRIDS my.sgrd -FORMAT XXX

Parameters
main_confthe conf maps containing the main.cfg settings
inthe output maps to fill with the resulting file
int sagaExportOGR ( maps **  conf,
maps **  in 
)

Export a SAGA-GIS Shapes to a file in a specific format (GML,KML,GeoJSON).

saga_cmd io_gdal 4 -FILE my.format -SHAPES my.shp -FORMAT XXX

Parameters
main_confthe conf maps containing the main.cfg settings
inthe output maps to fill with the resulting file
void sagaExportPC ( maps **  conf,
maps **  in 
)

Export a SAGA-GIS pointcloud to a las file.

saga_cmd io_shapes_las 0 -POINTS my.spc -FILE my.las

Parameters
main_confthe conf maps containing the main.cfg settings
inthe output maps to fill with the resulting file
int sagaExportTIN ( maps **  conf,
maps **  in,
const char *  tname 
)

Export a SAGA-GIS TIN to a file in a specific format (GML,KML,GeoJSON).

Exporting TIN produce 5 separated files (POINTS, CENTER, EDGES, TRIANGLES and POLYGONS). Even if a client can choose which result it want to have, SAGA-GIS module will be invoked in a way that it will produce in any case each possible outputs. The selection of a specific output is made in the ZOO-Kernel itself and not specifically at this level. saga_cmd tin_tools 3 -TIN my.shp -POINTS p.shp ...

Parameters
confthe conf maps containing the main.cfg settings
inthe output maps to fill with the resulting file
See also
sagaExportOGR
const char* sagaGetDefaultExt ( CSG_Parameter *  param)

Get the default file extension for SAGA-GIS parameter type.

Extensions are the following:

  • sgrd for grid and data_object
  • shp for shapes and tin
  • csv for tables
  • spc for points
Parameters
parama SAGA-GIS Parameter
int sagaImportGDAL ( maps **  conf,
maps **  in 
)

Import GDAL Datasource into SAGA-GIS.

saga_cmd io_gdal 0 -TRANSFORM 0 -FILES my.format -GRIDS /tmpPath/MyGridXXX.sgrd

Parameters
confthe conf maps containing the main.cfg settings
inin the inputs maps
int sagaImportOGR ( maps **  conf,
maps **  in 
)

Import OGR Datasource into SAGA-GIS.

saga_cmd io_gdal 3 -SHAPES my.shp -FILES my.format

Parameters
confthe conf maps containing the main.cfg settings
inin the inputs maps
int sagaImportPC ( maps **  conf,
maps **  in 
)

Import las file as pointcloud into SAGA-GIS.

saga_cmd io_shapes_las 1 -POINTS my.spc -FILENAME my.las

Parameters
confthe conf maps containing the main.cfg settings
inin the inputs maps
int sagaImportTable ( maps **  conf,
maps **  in 
)

Import table into SAGA-GIS.

saga_cmd io_table 1 -TABLE myTable -FILENAME myFile -SEPARATOR 2

Parameters
confthe conf maps containing the main.cfg settings
inin the inputs maps
bool sagaImportTIN ( maps **  conf,
maps **  in 
)

Import TIN into SAGA-GIS.

Calling this function suppose that sagaImportOGR was called first. saga_cmd tin_tools 2 -SHAPES myShapes.shp -TIN myTin.shp

Parameters
confthe conf maps containing the main.cfg settings
inin the inputs maps
See also
sagaImportOGR
bool sagaLoadInput ( CSG_Parameter *  param,
map arg 
)

Load a datasource in the SAGA-GIS Data Manager.

Parameters
parama SAGA-GIS Parameter
argthe arguments map passed to a SAGA-GIS module
Returns
false on failure, true in case of success
bool sagaSaveOutputs ( CSG_Parameters *  params,
maps main_conf,
maps **  outputs 
)

Save all values outputed by a SAGA-GIS module invocation to files.

Parameters
paramsthe parameters list
main_confthe conf maps containing the main.cfg settings
outputsthe maps to set the generated_file for each output
bool sagaSetParameters ( CSG_Parameters *  params,
map argument 
)

Extract all SAGA-GIS parameters from a parameters list and set its values to the one defined in the map.

params the parameters list argument the argument map containing the value to use

Returns
true in success, false in other case
int zoo_saga_support ( maps **  main_conf,
map request,
service s,
maps **  inputs,
maps **  outputs 
)

Load and invoke a SAGA-GIS module defined in a service metadata definitions.

Load all the input data into SAGA-GIS using io_gdal, io_tables and io_shapes_las for SAGA grids/shapes, tables and pointcloud respectively. Load and run the module from its library and invoke it using the data imported in SAGA-GIS at first stage. After the execution, export the outputs to files using io_gdal and io_shapes_las for grids/shapes and pointcloud respectively.

Parameters
main_confthe conf maps containing the main.cfg settings
requestthe map containing the HTTP request
sthe service structure
inputsthe maps containing the inputs
outputsthe maps containing the outputs

Variable Documentation

int sagaOutputCounter =0

Global SAGA-GIS output counter.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png