parser_wps.c 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #include <grass/config.h>
  6. #include <grass/gis.h>
  7. #include <grass/glocale.h>
  8. #if defined(HAVE_LANGINFO_H)
  9. #include <langinfo.h>
  10. #endif
  11. #if defined(__MINGW32__) && defined(USE_NLS)
  12. #include <localcharset.h>
  13. #endif
  14. #include "parser_local_proto.h"
  15. /* Defines and prototypes for WPS process_description XML document generation
  16. */
  17. #define TYPE_OTHER -1
  18. #define TYPE_RASTER 0
  19. #define TYPE_VECTOR 1
  20. #define TYPE_PLAIN_TEXT 2
  21. #define TYPE_RANGE 3
  22. #define TYPE_LIST 4
  23. #define TYPE_STDS 5 /* Space time datasets of type raster, raster3d and vector */
  24. #define TYPE_STRDS 6 /* Space time raster datasets */
  25. #define TYPE_STVDS 7 /* Space time vector datasets */
  26. #define WPS_INPUT 0
  27. #define WPS_OUTPUT 1
  28. static void wps_print_mimetype_text_plain(void);
  29. static void wps_print_mimetype_raster_tiff(void);
  30. static void wps_print_mimetype_raster_tiff_other(void);
  31. static void wps_print_mimetype_raster_png(void);
  32. static void wps_print_mimetype_raster_gif(void);
  33. static void wps_print_mimetype_raster_jpeg(void);
  34. static void wps_print_mimetype_raster_hfa(void);
  35. static void wps_print_mimetype_raster_netCDF(void);
  36. static void wps_print_mimetype_raster_netCDF_other(void);
  37. static void wps_print_mimetype_raster_grass_binary(void);
  38. static void wps_print_mimetype_raster_grass_ascii(void);
  39. static void wps_print_mimetype_vector_gml311(void);
  40. static void wps_print_mimetype_vector_gml311_appl(void);
  41. static void wps_print_mimetype_vector_gml212(void);
  42. static void wps_print_mimetype_vector_gml212_appl(void);
  43. static void wps_print_mimetype_vector_kml22(void);
  44. static void wps_print_mimetype_vector_dgn(void);
  45. static void wps_print_mimetype_vector_shape(void);
  46. static void wps_print_mimetype_vector_zipped_shape(void);
  47. static void wps_print_mimetype_vector_grass_ascii(void);
  48. static void wps_print_mimetype_vector_grass_binary(void);
  49. static void wps_print_mimetype_space_time_datasets(void);
  50. static void wps_print_mimetype_space_time_raster_datasets(void);
  51. static void wps_print_mimetype_space_time_vector_datasets(void);
  52. static void wps_print_mimetype_space_time_vector_datasets_tar(void);
  53. static void wps_print_mimetype_space_time_raster_datasets_tar(void);
  54. static void wps_print_mimetype_space_time_vector_datasets_tar_gz(void);
  55. static void wps_print_mimetype_space_time_raster_datasets_tar_gz(void);
  56. static void wps_print_mimetype_space_time_vector_datasets_tar_bz2(void);
  57. static void wps_print_mimetype_space_time_raster_datasets_tar_bz2(void);
  58. static void wps_print_process_descriptions_begin(void);
  59. static void wps_print_process_descriptions_end(void);
  60. static void wps_print_process_description_begin(int , int , const char *, const char *, const char *, const char **, int );
  61. static void wps_print_process_description_end(void);
  62. static void wps_print_data_inputs_begin(void);
  63. static void wps_print_data_inputs_end(void);
  64. static void wps_print_process_outputs_begin(void);
  65. static void wps_print_process_outputs_end(void);
  66. static void wps_print_bounding_box_data(void);
  67. static void wps_print_ident_title_abstract(const char *, const char *, const char *);
  68. static void wps_print_complex_input(int , int , const char *, const char *, const char *, int , int );
  69. static void wps_print_complex_output(const char *, const char *, const char *, int );
  70. static void wps_print_comlpex_input_output(int , int , int , const char *, const char *, const char *, int , int );
  71. static void wps_print_literal_input_output(int , int , int , const char *,
  72. const char *, const char *, const char *, int ,
  73. const char **, int , const char *, int );
  74. static void print_escaped_for_xml(FILE * fp, const char *str)
  75. {
  76. for (; *str; str++) {
  77. switch (*str) {
  78. case '&':
  79. fputs("&amp;", fp);
  80. break;
  81. case '<':
  82. fputs("&lt;", fp);
  83. break;
  84. case '>':
  85. fputs("&gt;", fp);
  86. break;
  87. default:
  88. fputc(*str, fp);
  89. }
  90. }
  91. }
  92. /*!
  93. * \brief Print the WPS 1.0.0 process description XML document to stdout
  94. *
  95. * A module started with the parameter "--wps-process-description"
  96. * will write a process description XML document to stdout and exit.
  97. *
  98. * Currently only raster and vector modules are supported, but the
  99. * generation works with any module (more or less meaningful).
  100. * Most of the input options are caught:
  101. * * single and multiple raster and vector maps
  102. * * single and multiple string, float and integer data with default
  103. * values and value options (range is missing)
  104. * Flags are supported as boolean values.
  105. *
  106. * The mime types for vector maps are GML, KML, dgn, shape and zipped shape.
  107. *
  108. * The mime types for raster maps are tiff, geotiff, hfa, netcdf, gif, jpeg and png.
  109. *
  110. * Mime types for space time datasets are tar archives with gz, bzip or without compression
  111. *
  112. * The mime types are reflecting the capabilities of grass and gdal and may be extended.
  113. *
  114. * BoundignBox support is currently not available for inputs and outputs.
  115. * Literal data output (string, float or integer) is currently not supported.
  116. *
  117. * In case no output parameter was set (new raster of vector map) the stdout output
  118. * is noticed as output parameter of mime type text/plain.
  119. *
  120. * Multiple vector or raster map outputs marked as one option are not supported (wps 1.0.0 specification
  121. * does not allow multiple outputs with only one identifier).
  122. * Multiple outputs must be wrapped via a python script or created as group.
  123. *
  124. * In future the following mimetypes may be supported
  125. * mime type: application/grass-vector-ascii -> a text file generated with v.out.asci
  126. * Example.: urn:file:///path/name
  127. * mime type: application/grass-vector-binary -> the binary vectors must be addressed with a non standard urn:
  128. * Example: urn:grass:vector:location/mapset/name
  129. * */
  130. void G__wps_print_process_description(void)
  131. {
  132. struct Option *opt;
  133. struct Flag *flag;
  134. char *type;
  135. char *s, *top;
  136. const char *value = NULL;
  137. int i;
  138. char *encoding;
  139. int new_prompt = 0;
  140. int store = 1;
  141. int status = 1;
  142. const char *identifier = NULL;
  143. const char *title = NULL;
  144. const char *abstract = NULL;
  145. const char **keywords = NULL;
  146. int data_type, is_input, is_output;
  147. int num_raster_inputs = 0, num_raster_outputs = 0;
  148. int num_vector_inputs = 0, num_vector_outputs = 0;
  149. int num_strds_inputs = 0, num_strds_outputs = 0;
  150. int num_stvds_inputs = 0, num_stvds_outputs = 0;
  151. int min = 0, max = 0;
  152. int num_keywords = 0;
  153. int found_output = 0;
  154. int is_tuple; /* Checks the key_descr for comma separated values */
  155. int num_tuples; /* Counts the "," in key_descr */
  156. new_prompt = G__uses_new_gisprompt();
  157. /* gettext converts strings to encoding returned by nl_langinfo(CODESET) */
  158. #if defined(HAVE_LANGINFO_H)
  159. encoding = nl_langinfo(CODESET);
  160. if (!encoding || strlen(encoding) == 0) {
  161. encoding = "UTF-8";
  162. }
  163. #elif defined(__MINGW32__) && defined(USE_NLS)
  164. encoding = locale_charset();
  165. if (!encoding || strlen(encoding) == 0) {
  166. encoding = "UTF-8";
  167. }
  168. #else
  169. encoding = "UTF-8";
  170. #endif
  171. if (!st->pgm_name)
  172. st->pgm_name = G_program_name();
  173. if (!st->pgm_name)
  174. st->pgm_name = "??";
  175. /* the identifier of the process is the module name */
  176. identifier = st->pgm_name;
  177. if (st->module_info.description) {
  178. title = st->module_info.description;
  179. abstract = st->module_info.description;
  180. }
  181. if (st->module_info.keywords) {
  182. keywords = st->module_info.keywords;
  183. num_keywords = st->n_keys;
  184. }
  185. wps_print_process_descriptions_begin();
  186. /* store and status are supported as default. The WPS server should change this if necessary */
  187. wps_print_process_description_begin(store, status, identifier, title, abstract, keywords, num_keywords);
  188. wps_print_data_inputs_begin();
  189. /* Print the bounding box element with all the coordinate reference systems, which are supported by grass*/
  190. /* Currently Disabled! A list of all proj4 supported EPSG coordinate reference systems must be implemented*/
  191. if(1 == 0)
  192. wps_print_bounding_box_data();
  193. /* We parse only the inputs at the beginning */
  194. if (st->n_opts) {
  195. opt = &st->first_option;
  196. while (opt != NULL) {
  197. identifier = NULL;
  198. title = NULL;
  199. abstract = NULL;
  200. keywords = NULL;
  201. num_keywords = 0;
  202. value = NULL;
  203. is_input = 1;
  204. is_output = 0;
  205. is_tuple = 0;
  206. num_tuples = 0;
  207. data_type = TYPE_OTHER;
  208. /* Check the gisprompt */
  209. if (opt->gisprompt) {
  210. const char *atts[] = { "age", "element", "prompt", NULL };
  211. top = G_calloc(strlen(opt->gisprompt) + 1, 1);
  212. strcpy(top, opt->gisprompt);
  213. s = strtok(top, ",");
  214. for (i = 0; s != NULL && atts[i] != NULL; i++) {
  215. char *token = G_store(s);
  216. /* we print only input parameter, sort out the output parameter */
  217. if(strcmp(token, "new") == 0) {
  218. is_input = 0;
  219. is_output = 1;
  220. }
  221. if(strcmp(token, "raster") == 0)
  222. {
  223. data_type = TYPE_RASTER;
  224. /* Count the raster inputs and outputs for default option creation */
  225. if(is_input == 1)
  226. num_raster_inputs++;
  227. if(is_output == 1)
  228. num_raster_outputs++;
  229. }
  230. if(strcmp(token, "vector") == 0)
  231. {
  232. data_type = TYPE_VECTOR;
  233. if(is_input == 1)
  234. num_vector_inputs++;
  235. if(is_output == 1)
  236. num_vector_outputs++;
  237. }
  238. /* Modules may have different types of space time datasets as inputs */
  239. if(strcmp(token, "stds") == 0)
  240. {
  241. data_type = TYPE_STDS;
  242. }
  243. if(strcmp(token, "strds") == 0)
  244. {
  245. data_type = TYPE_STRDS;
  246. if(is_input == 1)
  247. num_strds_inputs++;
  248. if(is_output == 1)
  249. num_strds_outputs++;
  250. }
  251. if(strcmp(token, "stvds") == 0)
  252. {
  253. data_type = TYPE_STVDS;
  254. if(is_input == 1)
  255. num_stvds_inputs++;
  256. if(is_output == 1)
  257. num_stvds_outputs++;
  258. }
  259. if(strcmp(token, "file") == 0)
  260. {
  261. data_type = TYPE_PLAIN_TEXT;
  262. }
  263. s = strtok(NULL, ",");
  264. G_free(token);
  265. }
  266. G_free(top);
  267. }
  268. /* Check the key description */
  269. if (opt->key_desc) {
  270. top = G_calloc(strlen(opt->key_desc) + 1, 1);
  271. strcpy(top, opt->key_desc);
  272. s = strtok(top, ",");
  273. /* Count comma's */
  274. for (i = 0; s != NULL; i++) {
  275. num_tuples++;
  276. s = strtok(NULL, ",");
  277. }
  278. if(num_tuples > 1)
  279. is_tuple = 1;
  280. G_free(top);
  281. }
  282. /* We have an input option */
  283. if(is_input == 1)
  284. {
  285. switch (opt->type) {
  286. case TYPE_INTEGER:
  287. type = "integer";
  288. break;
  289. case TYPE_DOUBLE:
  290. type = "float";
  291. break;
  292. case TYPE_STRING:
  293. type = "string";
  294. break;
  295. default:
  296. type = "string";
  297. break;
  298. }
  299. identifier = opt->key;
  300. if(opt->required == YES) {
  301. if(is_tuple)
  302. min = num_tuples;
  303. else
  304. min = 1;
  305. } else {
  306. min = 0;
  307. }
  308. if(opt->multiple == YES) {
  309. max = 1024;
  310. } else {
  311. if(is_tuple)
  312. max = num_tuples;
  313. else
  314. max = 1;
  315. }
  316. if(opt->label) {
  317. title = opt->label;
  318. }
  319. if (opt->description) {
  320. if(!opt->label)
  321. title = opt->description;
  322. else
  323. abstract = opt->description;
  324. }
  325. if (opt->def) {
  326. value = opt->def;
  327. }
  328. if (opt->options) {
  329. /* TODO:
  330. * add something like
  331. * <range min="xxx" max="xxx"/>
  332. * to <values> */
  333. i = 0;
  334. while (opt->opts[i]) {
  335. i++;
  336. }
  337. keywords = opt->opts;
  338. num_keywords = i;
  339. }
  340. if(data_type == TYPE_RASTER || data_type == TYPE_VECTOR ||
  341. data_type == TYPE_STRDS || data_type == TYPE_STVDS ||
  342. data_type == TYPE_STDS || data_type == TYPE_PLAIN_TEXT)
  343. {
  344. /* 2048 is the maximum size of the map in mega bytes */
  345. wps_print_complex_input(min, max, identifier, title, abstract, 2048, data_type);
  346. }
  347. else
  348. {
  349. /* The keyword array is missused for options, type means the type of the value (integer, float ... )*/
  350. wps_print_literal_input_output(WPS_INPUT, min, max, identifier, title,
  351. abstract, type, 0, keywords, num_keywords, value, TYPE_OTHER);
  352. }
  353. }
  354. opt = opt->next_opt;
  355. }
  356. }
  357. /* Flags are always input options and can be false or true (boolean) */
  358. if (st->n_flags) {
  359. flag = &st->first_flag;
  360. while (flag != NULL) {
  361. /* The identifier is the flag "-x" */
  362. char* ident = (char*)G_calloc(3, sizeof(char));
  363. ident[0] = '-';
  364. ident[1] = flag->key;
  365. ident[2] = '\0';
  366. title = NULL;
  367. abstract = NULL;
  368. if (flag->description) {
  369. title = flag->description;
  370. abstract = flag->description;
  371. }
  372. const char *val[] = {"true","false"};
  373. wps_print_literal_input_output(WPS_INPUT, 0, 1, ident, title, NULL, "boolean", 0, val, 2, "false", TYPE_OTHER);
  374. flag = flag->next_flag;
  375. }
  376. }
  377. /* We have two default options, which define the resolution of the created mapset */
  378. if(num_raster_inputs > 0 || num_raster_outputs > 0 || num_strds_inputs > 0 || num_strds_outputs > 0) {
  379. wps_print_literal_input_output(WPS_INPUT, 0, 1, "grass_resolution_ns", "Resolution of the mapset in north-south direction in meters or degrees",
  380. "This parameter defines the north-south resolution of the mapset in meter or degrees, which should be used to process the input and output raster data. To enable this setting, you need to specify north-south and east-west resolution.",
  381. "float", 1, NULL, 0, NULL, TYPE_OTHER);
  382. wps_print_literal_input_output(WPS_INPUT, 0, 1, "grass_resolution_ew", "Resolution of the mapset in east-west direction in meters or degrees",
  383. "This parameter defines the east-west resolution of the mapset in meters or degrees, which should be used to process the input and output raster data. To enable this setting, you need to specify north-south and east-west resolution.",
  384. "float", 1, NULL, 0, NULL, TYPE_OTHER);
  385. }
  386. /* In case multi band raster maps should be imported, the band number must be provided */
  387. if(num_raster_inputs > 0)
  388. wps_print_literal_input_output(WPS_INPUT, 0, 1, "grass_band_number", "Band to select for processing (default is all bands)",
  389. "This parameter defines band number of the input raster files which should be processed. As default all bands are processed and used as single and multiple inputs for raster modules.",
  390. "integer", 0, NULL, 0, NULL, TYPE_OTHER);
  391. /* End of inputs */
  392. wps_print_data_inputs_end();
  393. /* Start of the outputs */
  394. wps_print_process_outputs_begin();
  395. found_output = 0;
  396. /*parse the output. only raster maps, vector maps, space time raster and vector datasets plus stdout are supported */
  397. if (st->n_opts) {
  398. opt = &st->first_option;
  399. while (opt != NULL) {
  400. identifier = NULL;
  401. title = NULL;
  402. abstract = NULL;
  403. value = NULL;
  404. is_output = 0;
  405. data_type = TYPE_OTHER;
  406. if (opt->gisprompt) {
  407. const char *atts[] = { "age", "element", "prompt", NULL };
  408. top = G_calloc(strlen(opt->gisprompt) + 1, 1);
  409. strcpy(top, opt->gisprompt);
  410. s = strtok(top, ",");
  411. for (i = 0; s != NULL && atts[i] != NULL; i++) {
  412. char *token = G_store(s);
  413. /* we print only the output parameter */
  414. if(strcmp(token, "new") == 0)
  415. is_output = 1;
  416. if(strcmp(token, "raster") == 0)
  417. {
  418. data_type = TYPE_RASTER;
  419. }
  420. if(strcmp(token, "vector") == 0)
  421. {
  422. data_type = TYPE_VECTOR;
  423. }
  424. if(strcmp(token, "stds") == 0)
  425. {
  426. data_type = TYPE_STDS;
  427. }
  428. if(strcmp(token, "strds") == 0)
  429. {
  430. data_type = TYPE_STRDS;
  431. }
  432. if(strcmp(token, "stvds") == 0)
  433. {
  434. data_type = TYPE_STVDS;
  435. }
  436. if(strcmp(token, "file") == 0)
  437. {
  438. data_type = TYPE_PLAIN_TEXT;
  439. }
  440. s = strtok(NULL, ",");
  441. G_free(token);
  442. }
  443. G_free(top);
  444. }
  445. /* Only single module output is supported!! */
  446. if(is_output == 1)
  447. {
  448. if(opt->multiple == YES)
  449. G_warning(_("Multiple outputs are not supported by WPS 1.0.0"));
  450. identifier = opt->key;
  451. if(opt->label) {
  452. title = opt->label;
  453. }
  454. if (opt->description) {
  455. if(!opt->label)
  456. title = opt->description;
  457. else
  458. abstract = opt->description;
  459. }
  460. if(data_type == TYPE_RASTER || data_type == TYPE_VECTOR ||
  461. data_type == TYPE_STRDS || data_type == TYPE_STVDS ||
  462. data_type == TYPE_STDS || data_type == TYPE_PLAIN_TEXT) {
  463. wps_print_complex_output(identifier, title, abstract, data_type);
  464. found_output = 1;
  465. }
  466. }
  467. opt = opt->next_opt;
  468. }
  469. /* we assume the computatuon output on stdout, if no raster/vector output was found*/
  470. if(found_output == 0)
  471. wps_print_complex_output("stdout", "Module output on stdout", "The output of the module written to stdout", TYPE_PLAIN_TEXT);
  472. }
  473. wps_print_process_outputs_end();
  474. wps_print_process_description_end();
  475. wps_print_process_descriptions_end();
  476. }
  477. /**************************************************************************
  478. *
  479. * The remaining routines are all local (static) routines used to support
  480. * the the creation of the WPS process_description document.
  481. *
  482. **************************************************************************/
  483. static void wps_print_process_descriptions_begin(void)
  484. {
  485. fprintf(stdout, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  486. fprintf(stdout, "<wps:ProcessDescriptions xmlns:wps=\"http://www.opengis.net/wps/1.0.0\"\n");
  487. fprintf(stdout, "xmlns:ows=\"http://www.opengis.net/ows/1.1\"\n");
  488. fprintf(stdout, "xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n");
  489. fprintf(stdout, "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
  490. fprintf(stdout, "xsi:schemaLocation=\"http://www.opengis.net/wps/1.0.0\n http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_response.xsd\"\n service=\"WPS\" version=\"1.0.0\" xml:lang=\"en-US\"> \n");
  491. }
  492. /* ************************************************************************** */
  493. static void wps_print_process_descriptions_end(void)
  494. {
  495. fprintf(stdout,"</wps:ProcessDescriptions>\n");
  496. }
  497. /* ************************************************************************** */
  498. static void wps_print_process_description_begin(int store, int status, const char *identifier,
  499. const char *title, const char *abstract,
  500. const char **keywords, int num_keywords)
  501. {
  502. int i;
  503. fprintf(stdout,"\t<ProcessDescription wps:processVersion=\"1\" storeSupported=\"%s\" statusSupported=\"%s\">\n", (store?"true":"false"), (status?"true":"false"));
  504. if(identifier)
  505. {
  506. fprintf(stdout,"\t\t<ows:Identifier>");
  507. print_escaped_for_xml(stdout, identifier);
  508. fprintf(stdout,"</ows:Identifier>\n");
  509. } else {
  510. G_fatal_error("Identifier not defined");
  511. }
  512. if(title)
  513. {
  514. fprintf(stdout,"\t\t<ows:Title>");
  515. print_escaped_for_xml(stdout, title);
  516. fprintf(stdout, "</ows:Title>\n");
  517. } else {
  518. G_warning("Title not defined!");
  519. fprintf(stdout,"\t\t<ows:Title>");
  520. print_escaped_for_xml(stdout, "No title available");
  521. fprintf(stdout, "</ows:Title>\n");
  522. }
  523. if(abstract)
  524. {
  525. fprintf(stdout,"\t\t<ows:Abstract>");
  526. fprintf(stdout, "http://grass.osgeo.org/grass73/manuals/%s.html", identifier);
  527. fprintf(stdout, "</ows:Abstract>\n");
  528. }
  529. for(i = 0; i < num_keywords; i++)
  530. {
  531. fprintf(stdout,"\t\t<ows:Metadata xlink:title=\"");
  532. print_escaped_for_xml(stdout, keywords[i]);
  533. fprintf(stdout, "\" />\n");
  534. }
  535. }
  536. /* ************************************************************************** */
  537. static void wps_print_process_description_end(void)
  538. {
  539. fprintf(stdout,"\t</ProcessDescription>\n");
  540. }
  541. /* ************************************************************************** */
  542. static void wps_print_data_inputs_begin(void)
  543. {
  544. fprintf(stdout,"\t\t<DataInputs>\n");
  545. }
  546. /* ************************************************************************** */
  547. static void wps_print_data_inputs_end(void)
  548. {
  549. fprintf(stdout,"\t\t</DataInputs>\n");
  550. }
  551. /* ************************************************************************** */
  552. static void wps_print_process_outputs_begin(void)
  553. {
  554. fprintf(stdout,"\t\t<ProcessOutputs>\n");
  555. }
  556. /* ************************************************************************** */
  557. static void wps_print_process_outputs_end(void)
  558. {
  559. fprintf(stdout,"\t\t</ProcessOutputs>\n");
  560. }
  561. /* ************************************************************************** */
  562. static void wps_print_complex_input(int min, int max, const char *identifier, const char *title, const char *abstract, int megs, int type)
  563. {
  564. wps_print_comlpex_input_output(WPS_INPUT, min, max, identifier, title, abstract, megs, type);
  565. }
  566. /* ************************************************************************** */
  567. static void wps_print_complex_output(const char *identifier, const char *title, const char *abstract, int type)
  568. {
  569. wps_print_comlpex_input_output(WPS_OUTPUT, 0, 0, identifier, title, abstract, 0, type);
  570. }
  571. /* ************************************************************************** */
  572. static void wps_print_comlpex_input_output(int inout_type, int min, int max, const char *identifier, const char *title, const char *abstract, int megs, int type)
  573. {
  574. if(inout_type == WPS_INPUT)
  575. fprintf(stdout,"\t\t\t<Input minOccurs=\"%i\" maxOccurs=\"%i\">\n", min, max);
  576. else if(inout_type == WPS_OUTPUT)
  577. fprintf(stdout,"\t\t\t<Output>\n");
  578. wps_print_ident_title_abstract(identifier, title, abstract);
  579. if(inout_type == WPS_INPUT)
  580. fprintf(stdout,"\t\t\t\t<ComplexData maximumMegabytes=\"%i\">\n", megs);
  581. else if(inout_type == WPS_OUTPUT)
  582. fprintf(stdout,"\t\t\t\t<ComplexOutput>\n");
  583. fprintf(stdout,"\t\t\t\t\t<Default>\n");
  584. if(type == TYPE_RASTER)
  585. {
  586. wps_print_mimetype_raster_tiff();
  587. }
  588. else if(type == TYPE_VECTOR)
  589. {
  590. wps_print_mimetype_vector_gml311();
  591. }
  592. else if(type == TYPE_STDS)
  593. {
  594. /* A space time raster dataset is the default an any modules with multiple dataset options */
  595. wps_print_mimetype_space_time_raster_datasets_tar_gz();
  596. }
  597. else if(type == TYPE_STRDS)
  598. {
  599. wps_print_mimetype_space_time_raster_datasets_tar_gz();
  600. }
  601. else if(type == TYPE_STVDS)
  602. {
  603. wps_print_mimetype_space_time_vector_datasets_tar_gz();
  604. }
  605. else if(type == TYPE_PLAIN_TEXT)
  606. {
  607. wps_print_mimetype_text_plain();
  608. }
  609. fprintf(stdout,"\t\t\t\t\t</Default>\n");
  610. fprintf(stdout,"\t\t\t\t\t<Supported>\n");
  611. if(type == TYPE_RASTER)
  612. {
  613. /*The supported types for input and output are different*/
  614. if(inout_type == WPS_INPUT) {
  615. wps_print_mimetype_raster_tiff();
  616. wps_print_mimetype_raster_tiff_other();
  617. wps_print_mimetype_raster_png();
  618. wps_print_mimetype_raster_gif();
  619. wps_print_mimetype_raster_jpeg();
  620. wps_print_mimetype_raster_hfa();
  621. wps_print_mimetype_raster_netCDF();
  622. wps_print_mimetype_raster_netCDF_other();
  623. } else {
  624. wps_print_mimetype_raster_tiff();
  625. wps_print_mimetype_raster_tiff_other();
  626. wps_print_mimetype_raster_hfa();
  627. wps_print_mimetype_raster_netCDF();
  628. wps_print_mimetype_raster_netCDF_other();
  629. }
  630. }
  631. else if(type == TYPE_VECTOR)
  632. {
  633. if(inout_type == WPS_INPUT) {
  634. wps_print_mimetype_vector_gml311();
  635. wps_print_mimetype_vector_gml311_appl();
  636. wps_print_mimetype_vector_gml212();
  637. wps_print_mimetype_vector_gml212_appl();
  638. wps_print_mimetype_vector_kml22();
  639. wps_print_mimetype_vector_dgn();
  640. wps_print_mimetype_vector_shape();
  641. wps_print_mimetype_vector_zipped_shape();
  642. } else {
  643. wps_print_mimetype_vector_gml311();
  644. wps_print_mimetype_vector_gml311_appl();
  645. wps_print_mimetype_vector_gml212();
  646. wps_print_mimetype_vector_gml212_appl();
  647. wps_print_mimetype_vector_kml22();
  648. }
  649. }
  650. else if(type == TYPE_STDS)
  651. {
  652. wps_print_mimetype_space_time_datasets();
  653. }
  654. else if(type == TYPE_STRDS)
  655. {
  656. wps_print_mimetype_space_time_raster_datasets();
  657. }
  658. else if(type == TYPE_STVDS)
  659. {
  660. wps_print_mimetype_space_time_vector_datasets();
  661. }
  662. else if(type == TYPE_PLAIN_TEXT)
  663. {
  664. wps_print_mimetype_text_plain();
  665. }
  666. fprintf(stdout,"\t\t\t\t\t</Supported>\n");
  667. if(inout_type == WPS_INPUT)
  668. fprintf(stdout,"\t\t\t\t</ComplexData>\n");
  669. else if(inout_type == WPS_OUTPUT)
  670. fprintf(stdout,"\t\t\t\t</ComplexOutput>\n");
  671. if(inout_type == WPS_INPUT)
  672. fprintf(stdout,"\t\t\t</Input>\n");
  673. else if(inout_type == WPS_OUTPUT)
  674. fprintf(stdout,"\t\t\t</Output>\n");
  675. }
  676. /* ************************************************************************** */
  677. static void wps_print_ident_title_abstract(const char *identifier, const char *title, const char *abstract)
  678. {
  679. if(identifier)
  680. {
  681. fprintf(stdout,"\t\t\t\t<ows:Identifier>");
  682. print_escaped_for_xml(stdout, identifier);
  683. fprintf(stdout,"</ows:Identifier>\n");
  684. } else {
  685. G_fatal_error("Identifier not defined");
  686. }
  687. if(title)
  688. {
  689. fprintf(stdout,"\t\t\t\t<ows:Title>");
  690. print_escaped_for_xml(stdout, title);
  691. fprintf(stdout, "</ows:Title>\n");
  692. } else {
  693. G_warning("Title not defined!");
  694. fprintf(stdout,"\t\t\t\t<ows:Title>");
  695. print_escaped_for_xml(stdout, "No title available");
  696. fprintf(stdout, "</ows:Title>\n");
  697. }
  698. if(abstract)
  699. {
  700. fprintf(stdout,"\t\t\t\t<ows:Abstract>");
  701. print_escaped_for_xml(stdout, abstract);
  702. fprintf(stdout, "</ows:Abstract>\n");
  703. }
  704. }
  705. /* ************************************************************************** */
  706. static void wps_print_literal_input_output(int inout_type, int min, int max, const char *identifier,
  707. const char *title, const char *abstract, const char *datatype, int unitofmesure,
  708. const char **choices, int num_choices, const char *default_value, int type)
  709. {
  710. int i;
  711. char range[2][24];
  712. char *str;
  713. if(inout_type == WPS_INPUT)
  714. fprintf(stdout,"\t\t\t<Input minOccurs=\"%i\" maxOccurs=\"%i\">\n", min, max);
  715. else if(inout_type == WPS_OUTPUT)
  716. fprintf(stdout,"\t\t\t<Output>\n");
  717. wps_print_ident_title_abstract(identifier, title, abstract);
  718. fprintf(stdout,"\t\t\t\t<LiteralData>\n");
  719. if(datatype)
  720. fprintf(stdout,"\t\t\t\t\t<ows:DataType ows:reference=\"xs:%s\">%s</ows:DataType>\n", datatype, datatype);
  721. if(unitofmesure)
  722. {
  723. fprintf(stdout,"\t\t\t\t\t<UOMs>\n");
  724. fprintf(stdout,"\t\t\t\t\t\t<Default>\n");
  725. fprintf(stdout,"\t\t\t\t\t\t\t<ows:UOM>meters</ows:UOM>\n");
  726. fprintf(stdout,"\t\t\t\t\t\t</Default>\n");
  727. fprintf(stdout,"\t\t\t\t\t\t<Supported>\n");
  728. fprintf(stdout,"\t\t\t\t\t\t\t<ows:UOM>meters</ows:UOM>\n");
  729. fprintf(stdout,"\t\t\t\t\t\t\t<ows:UOM>degrees</ows:UOM>\n");
  730. fprintf(stdout,"\t\t\t\t\t\t</Supported>\n");
  731. fprintf(stdout,"\t\t\t\t\t</UOMs>\n");
  732. }
  733. if(num_choices == 0 || choices == NULL)
  734. fprintf(stdout,"\t\t\t\t\t<ows:AnyValue/>\n");
  735. else
  736. {
  737. /* Check for range values */
  738. if(strcmp(datatype, "integer") == 0 || strcmp(datatype, "float") == 0) {
  739. str = strtok((char*)choices[0], "-");
  740. if(str != NULL) {
  741. G_snprintf(range[0], 24, "%s", str);
  742. str = strtok(NULL, "-");
  743. if(str != NULL) {
  744. G_snprintf(range[1], 24, "%s", str);
  745. type = TYPE_RANGE;
  746. }
  747. }
  748. }
  749. fprintf(stdout,"\t\t\t\t\t<ows:AllowedValues>\n");
  750. if(type == TYPE_RANGE)
  751. {
  752. fprintf(stdout,"\t\t\t\t\t\t<ows:Range ows:rangeClosure=\"closed\">\n");
  753. fprintf(stdout,"\t\t\t\t\t\t\t<ows:MinimumValue>%s</ows:MinimumValue>\n", range[0]);
  754. fprintf(stdout,"\t\t\t\t\t\t\t<ows:MaximumValue>%s</ows:MaximumValue>\n", range[1]);
  755. fprintf(stdout,"\t\t\t\t\t\t</ows:Range>\n");
  756. }
  757. else
  758. {
  759. for(i = 0; i < num_choices; i++)
  760. {
  761. fprintf(stdout,"\t\t\t\t\t\t<ows:Value>");
  762. print_escaped_for_xml(stdout, choices[i]);
  763. fprintf(stdout,"</ows:Value>\n");
  764. }
  765. }
  766. fprintf(stdout,"\t\t\t\t\t</ows:AllowedValues>\n");
  767. }
  768. if(default_value)
  769. {
  770. fprintf(stdout,"\t\t\t\t\t<DefaultValue>");
  771. print_escaped_for_xml(stdout, default_value);
  772. fprintf(stdout,"</DefaultValue>\n");
  773. }
  774. fprintf(stdout,"\t\t\t\t</LiteralData>\n");
  775. if(inout_type == WPS_INPUT)
  776. fprintf(stdout,"\t\t\t</Input>\n");
  777. else if(inout_type == WPS_OUTPUT)
  778. fprintf(stdout,"\t\t\t</Output>\n");
  779. }
  780. /* ************************************************************************** */
  781. static void wps_print_mimetype_text_plain(void)
  782. {
  783. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  784. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>text/plain</MimeType>\n");
  785. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  786. }
  787. /* ************************************************************************** */
  788. static void wps_print_mimetype_raster_tiff(void)
  789. {
  790. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  791. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>image/tiff</MimeType>\n");
  792. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  793. }
  794. /* ************************************************************************** */
  795. static void wps_print_mimetype_raster_png(void)
  796. {
  797. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  798. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>image/png</MimeType>\n");
  799. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  800. }
  801. /* *** Native GRASS raster format urn:grass:raster:location/mapset/raster *** */
  802. static void wps_print_mimetype_raster_grass_binary(void)
  803. {
  804. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  805. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/grass-raster-binary</MimeType>\n");
  806. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  807. }
  808. /* *** GRASS raster maps exported via r.out.ascii ************************** */
  809. static void wps_print_mimetype_raster_grass_ascii(void)
  810. {
  811. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  812. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/grass-raster-ascii</MimeType>\n");
  813. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  814. }
  815. /* ************************************************************************** */
  816. static void wps_print_mimetype_vector_gml311_appl(void)
  817. {
  818. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  819. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/xml</MimeType>\n");
  820. fprintf(stdout,"\t\t\t\t\t\t\t<Encoding>UTF-8</Encoding>\n");
  821. fprintf(stdout,"\t\t\t\t\t\t\t<Schema>http://schemas.opengis.net/gml/3.1.1/base/gml.xsd</Schema>\n");
  822. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  823. }
  824. /* ************************************************************************** */
  825. static void wps_print_mimetype_vector_gml212_appl(void)
  826. {
  827. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  828. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/xml</MimeType>\n");
  829. fprintf(stdout,"\t\t\t\t\t\t\t<Encoding>UTF-8</Encoding>\n");
  830. fprintf(stdout,"\t\t\t\t\t\t\t<Schema>http://schemas.opengis.net/gml/2.1.2/feature.xsd</Schema>\n");
  831. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  832. }
  833. /* ************************************************************************** */
  834. static void wps_print_mimetype_vector_gml311(void)
  835. {
  836. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  837. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>text/xml</MimeType>\n");
  838. fprintf(stdout,"\t\t\t\t\t\t\t<Encoding>UTF-8</Encoding>\n");
  839. fprintf(stdout,"\t\t\t\t\t\t\t<Schema>http://schemas.opengis.net/gml/3.1.1/base/gml.xsd</Schema>\n");
  840. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  841. }
  842. /* ************************************************************************** */
  843. static void wps_print_mimetype_vector_gml212(void)
  844. {
  845. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  846. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>text/xml</MimeType>\n");
  847. fprintf(stdout,"\t\t\t\t\t\t\t<Encoding>UTF-8</Encoding>\n");
  848. fprintf(stdout,"\t\t\t\t\t\t\t<Schema>http://schemas.opengis.net/gml/2.1.2/feature.xsd</Schema>\n");
  849. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  850. }
  851. /* *** GRASS vector format exported via v.out.ascii ************************** */
  852. static void wps_print_mimetype_vector_grass_ascii(void)
  853. {
  854. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  855. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/grass-vector-ascii</MimeType>\n");
  856. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  857. }
  858. /* *** Native GRASS vector format urn:grass:vector:location/mapset/vector *** */
  859. static void wps_print_mimetype_vector_grass_binary(void)
  860. {
  861. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  862. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/grass-vector-binary</MimeType>\n");
  863. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  864. }
  865. /* *** Space time dataset format using tar, tar.gz and tar.bz2 methods for packaging */
  866. static void wps_print_mimetype_space_time_datasets(void)
  867. {
  868. wps_print_mimetype_space_time_raster_datasets();
  869. wps_print_mimetype_space_time_vector_datasets();
  870. }
  871. /* *** Space time raster dataset format using tar, tar.gz and tar.bz2 methods for packaging */
  872. static void wps_print_mimetype_space_time_raster_datasets(void)
  873. {
  874. wps_print_mimetype_space_time_raster_datasets_tar();
  875. wps_print_mimetype_space_time_raster_datasets_tar_gz();
  876. wps_print_mimetype_space_time_raster_datasets_tar_bz2();
  877. }
  878. static void wps_print_mimetype_space_time_raster_datasets_tar(void)
  879. {
  880. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  881. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-grass-strds-tar</MimeType>\n");
  882. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  883. }
  884. static void wps_print_mimetype_space_time_raster_datasets_tar_gz(void)
  885. {
  886. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  887. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-grass-strds-tar-gz</MimeType>\n");
  888. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  889. }
  890. static void wps_print_mimetype_space_time_raster_datasets_tar_bz2(void)
  891. {
  892. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  893. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-grass-strds-tar-bzip</MimeType>\n");
  894. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  895. }
  896. /* *** Space time vector dataset format using tar, tar.gz and tar.bz2 methods for packaging */
  897. static void wps_print_mimetype_space_time_vector_datasets(void)
  898. {
  899. wps_print_mimetype_space_time_vector_datasets_tar();
  900. wps_print_mimetype_space_time_vector_datasets_tar_gz();
  901. wps_print_mimetype_space_time_vector_datasets_tar_bz2();
  902. }
  903. static void wps_print_mimetype_space_time_vector_datasets_tar(void)
  904. {
  905. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  906. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-grass-stvds-tar</MimeType>\n");
  907. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  908. }
  909. static void wps_print_mimetype_space_time_vector_datasets_tar_gz(void)
  910. {
  911. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  912. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-grass-stvds-tar-gz</MimeType>\n");
  913. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  914. }
  915. static void wps_print_mimetype_space_time_vector_datasets_tar_bz2(void)
  916. {
  917. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  918. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-grass-stvds-tar-bzip</MimeType>\n");
  919. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  920. }
  921. /* ************************************************************************** */
  922. static void wps_print_mimetype_raster_gif(void)
  923. {
  924. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  925. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>image/gif</MimeType>\n");
  926. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  927. }
  928. /* ************************************************************************** */
  929. static void wps_print_mimetype_raster_jpeg(void)
  930. {
  931. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  932. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>image/jpeg</MimeType>\n");
  933. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  934. }
  935. /* ************************************************************************** */
  936. static void wps_print_mimetype_raster_hfa(void)
  937. {
  938. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  939. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-erdas-hfa</MimeType>\n");
  940. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  941. }
  942. /* ************************************************************************** */
  943. static void wps_print_mimetype_raster_tiff_other(void)
  944. {
  945. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  946. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>image/geotiff</MimeType>\n");
  947. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  948. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  949. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/geotiff</MimeType>\n");
  950. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  951. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  952. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-geotiff</MimeType>\n");
  953. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  954. }
  955. /* ************************************************************************** */
  956. static void wps_print_mimetype_raster_netCDF(void)
  957. {
  958. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  959. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/netcdf</MimeType>\n");
  960. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  961. }
  962. /* ************************************************************************** */
  963. static void wps_print_mimetype_raster_netCDF_other(void)
  964. {
  965. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  966. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-netcdf</MimeType>\n");
  967. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  968. }
  969. /* ************************************************************************** */
  970. static void wps_print_mimetype_vector_kml22(void)
  971. {
  972. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  973. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>text/xml</MimeType>\n");
  974. fprintf(stdout,"\t\t\t\t\t\t\t<Encoding>UTF-8</Encoding>\n");
  975. fprintf(stdout,"\t\t\t\t\t\t\t<Schema>http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd</Schema>\n");
  976. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  977. }
  978. /* ************************************************************************** */
  979. static void wps_print_mimetype_vector_dgn(void)
  980. {
  981. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  982. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/dgn</MimeType>\n");
  983. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  984. }
  985. /* ************************************************************************** */
  986. static void wps_print_mimetype_vector_shape(void)
  987. {
  988. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  989. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/shp</MimeType>\n");
  990. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  991. }
  992. /* ************************************************************************** */
  993. static void wps_print_mimetype_vector_zipped_shape(void)
  994. {
  995. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  996. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/x-zipped-shp</MimeType>\n");
  997. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  998. }
  999. /* Bounding box data input. Do not use! Under construction. A list of coordinate reference systems must be created.*/
  1000. static void wps_print_bounding_box_data(void)
  1001. {
  1002. int i;
  1003. fprintf(stdout,"\t\t\t<Input minOccurs=\"0\" maxOccurs=\"1\">\n");
  1004. wps_print_ident_title_abstract("BoundingBox", "Bounding box to process data",
  1005. "The bounding box is uesed to create the reference coordinate system in grass, as well as the lower left and upper right corner of the processing area.");
  1006. fprintf(stdout,"\t\t\t\t<BoundingBoxData>\n");
  1007. /* A meaningful default boundingbox should be chosen*/
  1008. fprintf(stdout,"\t\t\t\t\t<Default>\n");
  1009. fprintf(stdout,"\t\t\t\t\t\t<CRS>urn:ogc:def:crs,crs:EPSG:6.3:32760</CRS>\n");
  1010. fprintf(stdout,"\t\t\t\t\t</Default>\n");
  1011. /* A list of all proj4 supported EPSG coordinate systems should be created */
  1012. fprintf(stdout,"\t\t\t\t\t<Supported>\n");
  1013. for(i = 0; i < 1; i++)
  1014. fprintf(stdout,"\t\t\t\t\t\t<CRS>urn:ogc:def:crs,crs:EPSG:6.3:32760</CRS>\n");
  1015. fprintf(stdout,"\t\t\t\t\t</Supported>\n");
  1016. fprintf(stdout,"\t\t\t\t</BoundingBoxData>\n");
  1017. fprintf(stdout,"\t\t\t</Input>\n");
  1018. }