ZOO-Project
|
#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... | |
#define _ZOO_SAGA |
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.
main_conf | the conf maps containing the main.cfg settings |
lib_name | the SAGA-GIS library name |
module_name | the SAGA-GIS module name |
arguments | the map containing the arguments to pass to the module |
outputs | default to NULL, contains the maps to fill with the result |
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
main_conf | the conf maps containing the main.cfg settings |
in | the output maps to fill with the resulting file |
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
main_conf | the conf maps containing the main.cfg settings |
in | the output maps to fill with the resulting file |
Export a SAGA-GIS pointcloud to a las file.
saga_cmd io_shapes_las 0 -POINTS my.spc -FILE my.las
main_conf | the conf maps containing the main.cfg settings |
in | the output maps to fill with the resulting file |
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 ...
conf | the conf maps containing the main.cfg settings |
in | the output maps to fill with the resulting file |
const char* sagaGetDefaultExt | ( | CSG_Parameter * | param | ) |
Get the default file extension for SAGA-GIS parameter type.
Extensions are the following:
param | a SAGA-GIS Parameter |
Import GDAL Datasource into SAGA-GIS.
saga_cmd io_gdal 0 -TRANSFORM 0 -FILES my.format -GRIDS /tmpPath/MyGridXXX.sgrd
conf | the conf maps containing the main.cfg settings |
in | in the inputs maps |
Import OGR Datasource into SAGA-GIS.
saga_cmd io_gdal 3 -SHAPES my.shp -FILES my.format
conf | the conf maps containing the main.cfg settings |
in | in the inputs maps |
Import las file as pointcloud into SAGA-GIS.
saga_cmd io_shapes_las 1 -POINTS my.spc -FILENAME my.las
conf | the conf maps containing the main.cfg settings |
in | in the inputs maps |
Import table into SAGA-GIS.
saga_cmd io_table 1 -TABLE myTable -FILENAME myFile -SEPARATOR 2
conf | the conf maps containing the main.cfg settings |
in | in the inputs maps |
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
conf | the conf maps containing the main.cfg settings |
in | in the inputs maps |
bool sagaLoadInput | ( | CSG_Parameter * | param, |
map * | arg | ||
) |
Load a datasource in the SAGA-GIS Data Manager.
param | a SAGA-GIS Parameter |
arg | the arguments map passed to a SAGA-GIS module |
Save all values outputed by a SAGA-GIS module invocation to files.
params | the parameters list |
main_conf | the conf maps containing the main.cfg settings |
outputs | the 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
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.
main_conf | the conf maps containing the main.cfg settings |
request | the map containing the HTTP request |
s | the service structure |
inputs | the maps containing the inputs |
outputs | the maps containing the outputs |
int sagaOutputCounter =0 |
Global SAGA-GIS output counter.