parser_wps.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. #include "parser_local_proto.h"
  2. /* Defines and prototypes for WPS process_description XML document generation
  3. */
  4. #define TYPE_OTHER -1
  5. #define TYPE_RASTER 0
  6. #define TYPE_VECTOR 1
  7. #define TYPE_PLAIN_TEXT 2
  8. #define TYPE_RANGE 3
  9. #define TYPE_LIST 4
  10. #define WPS_INPUT 0
  11. #define WPS_OUTPUT 1
  12. static void wps_print_process_descriptions_begin(void);
  13. static void wps_print_process_descriptions_end(void);
  14. static void wps_print_process_description_begin(int , int , const char *, const char *, const char *, const char **, int );
  15. static void wps_print_process_description_end(void);
  16. static void wps_print_data_inputs_begin(void);
  17. static void wps_print_data_inputs_end(void);
  18. static void wps_print_process_outputs_begin(void);
  19. static void wps_print_process_outputs_end(void);
  20. static void wps_print_mimetype_text_plain(void);
  21. static void wps_print_mimetype_raster_tiff(void);
  22. static void wps_print_mimetype_raster_png(void);
  23. static void wps_print_mimetype_raster_grass_binary(void);
  24. static void wps_print_mimetype_raster_grass_ascii(void);
  25. static void wps_print_mimetype_vector_gml310(void);
  26. static void wps_print_mimetype_vector_grass_ascii(void);
  27. static void wps_print_mimetype_vector_grass_binary(void);
  28. static void wps_print_ident_title_abstract(const char *, const char *, const char *);
  29. static void wps_print_complex_input(int , int , const char *, const char *, const char *, int , int );
  30. static void wps_print_complex_output(const char *, const char *, const char *, int );
  31. static void wps_print_comlpex_input_output(int , int , int , const char *, const char *, const char *, int , int );
  32. static void wps_print_literal_input_output(int , int , int , const char *,
  33. const char *, const char *, const char *, int ,
  34. const char **, int , const char *, int );
  35. static void print_escaped_for_xml(FILE * fp, const char *str)
  36. {
  37. for (; *str; str++) {
  38. switch (*str) {
  39. case '&':
  40. fputs("&", fp);
  41. break;
  42. case '<':
  43. fputs("&lt;", fp);
  44. break;
  45. case '>':
  46. fputs("&gt;", fp);
  47. break;
  48. default:
  49. fputc(*str, fp);
  50. }
  51. }
  52. }
  53. /*!
  54. * \brief Print the WPS 1.0.0 process description XML document to stdout
  55. *
  56. * Currently only raster and vector maps are supported as inputs and outputs.
  57. * Literal data of type boolean, integer, double and string are supported
  58. * as input parameter. FLags are managed as boolean literal data and are always input parameter.
  59. *
  60. * In case no output parameter was set (new raster of vector map) the stdout output
  61. * is noticed as output parameter of mime type text/plain.
  62. *
  63. * Multiple vector or raster map outputs are not supported (wps 1.0.0 specification
  64. * does not allow multiple outputs). Multiple outputs must be wrapped via a python script.
  65. *
  66. * There is not support for optional outputs.
  67. *
  68. * */
  69. void G__wps_print_process_description(void)
  70. {
  71. struct Option *opt;
  72. struct Flag *flag;
  73. char *type;
  74. char *s, *top;
  75. const char *value = NULL;
  76. int i;
  77. char *encoding;
  78. int new_prompt = 0;
  79. int store = 1;
  80. int status = 1;
  81. const char *identifier = NULL;
  82. const char *title = NULL;
  83. const char *abstract = NULL;
  84. const char **keywords = NULL;
  85. int data_type, is_input, is_output;
  86. int min = 0, max = 0;
  87. int num_keywords = 0;
  88. int found_output = 0;
  89. new_prompt = G__uses_new_gisprompt();
  90. /* gettext converts strings to encoding returned by nl_langinfo(CODESET) */
  91. #if defined(HAVE_LANGINFO_H)
  92. encoding = nl_langinfo(CODESET);
  93. if (!encoding || strlen(encoding) == 0) {
  94. encoding = "UTF-8";
  95. }
  96. #elif defined(__MINGW32__) && defined(USE_NLS)
  97. encoding = locale_charset();
  98. if (!encoding || strlen(encoding) == 0) {
  99. encoding = "UTF-8";
  100. }
  101. #else
  102. encoding = "UTF-8";
  103. #endif
  104. if (!st->pgm_name)
  105. st->pgm_name = G_program_name();
  106. if (!st->pgm_name)
  107. st->pgm_name = "??";
  108. /* the identifier of the process is the module name */
  109. identifier = st->pgm_name;
  110. if (st->module_info.description) {
  111. title = st->module_info.description;
  112. abstract = st->module_info.description;
  113. }
  114. if (st->module_info.keywords) {
  115. keywords = st->module_info.keywords;
  116. num_keywords = st->n_keys;
  117. }
  118. wps_print_process_descriptions_begin();
  119. /* store and status are supported as default. The WPS server should change this if nessessary */
  120. wps_print_process_description_begin(store, status, identifier, title, abstract, keywords, num_keywords);
  121. wps_print_data_inputs_begin();
  122. /* We parse only the inputs at the beginning */
  123. if (st->n_opts) {
  124. opt = &st->first_option;
  125. while (opt != NULL) {
  126. identifier = NULL;
  127. title = NULL;
  128. abstract = NULL;
  129. keywords = NULL;
  130. num_keywords = 0;
  131. value = NULL;
  132. is_input = 1;
  133. data_type = TYPE_OTHER;
  134. if (opt->gisprompt) {
  135. const char *atts[] = { "age", "element", "prompt", NULL };
  136. top = G_calloc(strlen(opt->gisprompt) + 1, 1);
  137. strcpy(top, opt->gisprompt);
  138. s = strtok(top, ",");
  139. for (i = 0; s != NULL && atts[i] != NULL; i++) {
  140. char *token = G_store(s);
  141. /* we print only input parameter, sort out the output parameter */
  142. if(strcmp(token, "new") == 0)
  143. is_input = 0;
  144. if(strcmp(token, "raster") == 0)
  145. {
  146. data_type = TYPE_RASTER;
  147. }
  148. if(strcmp(token, "vector") == 0)
  149. {
  150. data_type = TYPE_VECTOR;
  151. }
  152. s = strtok(NULL, ",");
  153. G_free(token);
  154. }
  155. G_free(top);
  156. }
  157. /* We have an input option */
  158. if(is_input == 1)
  159. {
  160. switch (opt->type) {
  161. case TYPE_INTEGER:
  162. type = "integer";
  163. break;
  164. case TYPE_DOUBLE:
  165. type = "float";
  166. break;
  167. case TYPE_STRING:
  168. type = "string";
  169. break;
  170. default:
  171. type = "string";
  172. break;
  173. }
  174. identifier = opt->key;
  175. if(opt->required == YES)
  176. min = 1;
  177. else
  178. min = 0;
  179. if(opt->multiple == YES)
  180. max = 1024;
  181. else
  182. max = 1;
  183. if (opt->description) {
  184. title = opt->description;
  185. abstract = opt->description;
  186. }
  187. if (opt->def) {
  188. value = opt->def;
  189. }
  190. if (opt->options) {
  191. /* TODO:
  192. * add something like
  193. * <range min="xxx" max="xxx"/>
  194. * to <values> */
  195. i = 0;
  196. while (opt->opts[i]) {
  197. i++;
  198. }
  199. keywords = opt->opts;
  200. num_keywords = i;
  201. }
  202. if(data_type == TYPE_RASTER || data_type == TYPE_VECTOR)
  203. {
  204. /* 2048 is the maximum size of the map in mega bytes */
  205. wps_print_complex_input(min, max, identifier, title, abstract, 2048, data_type);
  206. }
  207. else
  208. {
  209. /* The keyword array is missused for options, type means the type of the value (integer, float ... )*/
  210. wps_print_literal_input_output(WPS_INPUT, min, max, identifier, title, abstract, type, 0, keywords, num_keywords, value, TYPE_OTHER);
  211. }
  212. }
  213. opt = opt->next_opt;
  214. }
  215. }
  216. /* Flags are always input options and can be false or true (boolean) */
  217. if (st->n_flags) {
  218. flag = &st->first_flag;
  219. while (flag != NULL) {
  220. /* The identifier is the flag "-x" */
  221. char* ident = (char*)G_calloc(3, sizeof(char));
  222. ident[0] = '-';
  223. ident[1] = flag->key;
  224. ident[2] = '\0';
  225. title = NULL;
  226. abstract = NULL;
  227. if (flag->description) {
  228. title = flag->description;
  229. abstract = flag->description;
  230. }
  231. const char *val[] = {"true","false"};
  232. wps_print_literal_input_output(WPS_INPUT, 0, 1, ident, title, abstract, "boolean", 0, val, 2, "false", TYPE_OTHER);
  233. flag = flag->next_flag;
  234. }
  235. }
  236. /* End of inputs */
  237. wps_print_data_inputs_end();
  238. /* Start of the outputs */
  239. wps_print_process_outputs_begin();
  240. found_output = 0;
  241. /*parse the ouput. only raster and vector map and stdout are supported */
  242. if (st->n_opts) {
  243. opt = &st->first_option;
  244. while (opt != NULL) {
  245. identifier = NULL;
  246. title = NULL;
  247. abstract = NULL;
  248. value = NULL;
  249. is_output = 0;
  250. data_type = TYPE_OTHER;
  251. if (opt->gisprompt) {
  252. const char *atts[] = { "age", "element", "prompt", NULL };
  253. top = G_calloc(strlen(opt->gisprompt) + 1, 1);
  254. strcpy(top, opt->gisprompt);
  255. s = strtok(top, ",");
  256. for (i = 0; s != NULL && atts[i] != NULL; i++) {
  257. char *token = G_store(s);
  258. /* we print only the output parameter */
  259. if(strcmp(token, "new") == 0)
  260. is_output = 1;
  261. if(strcmp(token, "raster") == 0)
  262. {
  263. data_type = TYPE_RASTER;
  264. }
  265. if(strcmp(token, "vector") == 0)
  266. {
  267. data_type = TYPE_VECTOR;
  268. }
  269. s = strtok(NULL, ",");
  270. G_free(token);
  271. }
  272. G_free(top);
  273. }
  274. /* Only single module output is supported */
  275. if(is_output == 1 && opt->multiple == NO)
  276. {
  277. identifier = opt->key;
  278. if (opt->description) {
  279. title = opt->description;
  280. abstract = opt->description;
  281. }
  282. /* Only raster and vector output is supported by option */
  283. if(data_type == TYPE_RASTER || data_type == TYPE_VECTOR)
  284. {
  285. wps_print_complex_output(identifier, title, abstract, data_type);
  286. found_output = 1;
  287. }
  288. }
  289. opt = opt->next_opt;
  290. }
  291. /* we assume the computatuon output on stdout, if no raster/vector output was found*/
  292. if(found_output == 0)
  293. wps_print_complex_output("stdout", "Module output on stdout", "The output of the module written to stdout", TYPE_PLAIN_TEXT);
  294. }
  295. wps_print_process_outputs_end();
  296. wps_print_process_description_end();
  297. wps_print_process_descriptions_end();
  298. }
  299. /**************************************************************************
  300. *
  301. * The remaining routines are all local (static) routines used to support
  302. * the the creation of the WPS process_description document.
  303. *
  304. **************************************************************************/
  305. static void wps_print_process_descriptions_begin(void)
  306. {
  307. fprintf(stdout, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  308. fprintf(stdout, "<wps:ProcessDescriptions xmlns:wps=\"http://www.opengis.net/wps/1.0.0\"\n");
  309. fprintf(stdout, "xmlns:ows=\"http://www.opengis.net/ows/1.1\"\n");
  310. fprintf(stdout, "xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n");
  311. fprintf(stdout, "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
  312. 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");
  313. }
  314. /* ************************************************************************** */
  315. static void wps_print_process_descriptions_end(void)
  316. {
  317. fprintf(stdout,"</wps:ProcessDescriptions>\n");
  318. }
  319. /* ************************************************************************** */
  320. static void wps_print_process_description_begin(int store, int status, const char *identifier,
  321. const char *title, const char *abstract,
  322. const char **keywords, int num_keywords)
  323. {
  324. int i;
  325. fprintf(stdout,"\t<ProcessDescription wps:processVersion=\"1\" storeSupported=\"%s\" statusSupported=\"%s\">\n", (store?"true":"false"), (status?"true":"false"));
  326. wps_print_ident_title_abstract(identifier, title, abstract);
  327. for(i = 0; i < num_keywords; i++)
  328. {
  329. fprintf(stdout,"\t\t<ows:Metadata xlink:title=\"");
  330. print_escaped_for_xml(stdout, keywords[i]);
  331. fprintf(stdout, "\" />\n");
  332. }
  333. }
  334. /* ************************************************************************** */
  335. static void wps_print_process_description_end(void)
  336. {
  337. fprintf(stdout,"\t</ProcessDescription>\n");
  338. }
  339. /* ************************************************************************** */
  340. static void wps_print_data_inputs_begin(void)
  341. {
  342. fprintf(stdout,"\t\t<DataInputs>\n");
  343. }
  344. /* ************************************************************************** */
  345. static void wps_print_data_inputs_end(void)
  346. {
  347. fprintf(stdout,"\t\t</DataInputs>\n");
  348. }
  349. /* ************************************************************************** */
  350. static void wps_print_process_outputs_begin(void)
  351. {
  352. fprintf(stdout,"\t\t<ProcessOutputs>\n");
  353. }
  354. /* ************************************************************************** */
  355. static void wps_print_process_outputs_end(void)
  356. {
  357. fprintf(stdout,"\t\t</ProcessOutputs>\n");
  358. }
  359. /* ************************************************************************** */
  360. static void wps_print_complex_input(int min, int max, const char *identifier, const char *title, const char *abstract, int megs, int type)
  361. {
  362. wps_print_comlpex_input_output(WPS_INPUT, min, max, identifier, title, abstract, megs, type);
  363. }
  364. /* ************************************************************************** */
  365. static void wps_print_complex_output(const char *identifier, const char *title, const char *abstract, int type)
  366. {
  367. wps_print_comlpex_input_output(WPS_OUTPUT, 0, 0, identifier, title, abstract, 0, type);
  368. }
  369. /* ************************************************************************** */
  370. 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)
  371. {
  372. if(inout_type == WPS_INPUT)
  373. fprintf(stdout,"\t\t\t<Input minOccurs=\"%i\" maxOccurs=\"%i\">\n", min, max);
  374. else if(inout_type == WPS_OUTPUT)
  375. fprintf(stdout,"\t\t\t<Output>\n");
  376. wps_print_ident_title_abstract(identifier, title, abstract);
  377. if(inout_type == WPS_INPUT)
  378. fprintf(stdout,"\t\t\t\t<ComplexData maximumMegabytes=\"%i\">\n", megs);
  379. else if(inout_type == WPS_OUTPUT)
  380. fprintf(stdout,"\t\t\t\t<ComplexOutput>\n");
  381. fprintf(stdout,"\t\t\t\t\t<Default>\n");
  382. if(type == TYPE_RASTER)
  383. {
  384. wps_print_mimetype_raster_tiff();
  385. }
  386. else if(type == TYPE_VECTOR)
  387. {
  388. wps_print_mimetype_vector_gml310();
  389. }
  390. else if(type == TYPE_PLAIN_TEXT)
  391. {
  392. wps_print_mimetype_text_plain();
  393. }
  394. fprintf(stdout,"\t\t\t\t\t</Default>\n");
  395. fprintf(stdout,"\t\t\t\t\t<Supported>\n");
  396. if(type == TYPE_RASTER)
  397. {
  398. wps_print_mimetype_raster_tiff();
  399. wps_print_mimetype_raster_png();
  400. wps_print_mimetype_raster_grass_ascii();
  401. wps_print_mimetype_raster_grass_binary();
  402. }
  403. else if(type == TYPE_VECTOR)
  404. {
  405. wps_print_mimetype_vector_gml310();
  406. wps_print_mimetype_vector_grass_ascii();
  407. wps_print_mimetype_vector_grass_binary();
  408. }
  409. else if(type == TYPE_PLAIN_TEXT)
  410. {
  411. wps_print_mimetype_text_plain();
  412. }
  413. fprintf(stdout,"\t\t\t\t\t</Supported>\n");
  414. if(inout_type == WPS_INPUT)
  415. fprintf(stdout,"\t\t\t\t</ComplexData>\n");
  416. else if(inout_type == WPS_OUTPUT)
  417. fprintf(stdout,"\t\t\t\t</ComplexOutput>\n");
  418. if(inout_type == WPS_INPUT)
  419. fprintf(stdout,"\t\t\t</Input>\n");
  420. else if(inout_type == WPS_OUTPUT)
  421. fprintf(stdout,"\t\t\t</Output>\n");
  422. }
  423. /* ************************************************************************** */
  424. static void wps_print_ident_title_abstract(const char *identifier, const char *title, const char *abstract)
  425. {
  426. if(identifier)
  427. {
  428. fprintf(stdout,"\t\t\t\t<ows:Identifier>");
  429. print_escaped_for_xml(stdout, identifier);
  430. fprintf(stdout,"</ows:Identifier>\n");
  431. }
  432. if(title)
  433. {
  434. fprintf(stdout,"\t\t\t\t<ows:Title>");
  435. print_escaped_for_xml(stdout, title);
  436. fprintf(stdout, "</ows:Title>\n");
  437. }
  438. if(abstract)
  439. {
  440. fprintf(stdout,"\t\t\t\t<ows:Abstract>");
  441. print_escaped_for_xml(stdout, abstract);
  442. fprintf(stdout, "</ows:Abstract>\n");
  443. }
  444. }
  445. /* ************************************************************************** */
  446. static void wps_print_literal_input_output(int inout_type, int min, int max, const char *identifier,
  447. const char *title, const char *abstract, const char *datatype, int unitofmesure,
  448. const char **choices, int num_choices, const char *default_value, int type)
  449. {
  450. int i;
  451. if(inout_type == WPS_INPUT)
  452. fprintf(stdout,"\t\t\t<Input minOccurs=\"%i\" maxOccurs=\"%i\">\n", min, max);
  453. else if(inout_type == WPS_OUTPUT)
  454. fprintf(stdout,"\t\t\t<Output>\n");
  455. wps_print_ident_title_abstract(identifier, title, abstract);
  456. fprintf(stdout,"\t\t\t\t<LiteralData>\n");
  457. if(datatype)
  458. fprintf(stdout,"\t\t\t\t\t<ows:DataType ows:reference=\"xs:%s\">%s</ows:DataType>\n", datatype, datatype);
  459. if(unitofmesure)
  460. {
  461. fprintf(stdout,"\t\t\t\t\t<UOMs>\n");
  462. fprintf(stdout,"\t\t\t\t\t<Default>\n");
  463. fprintf(stdout,"\t\t\t\t\t\t<ows:UOM>meters</ows:UOM>\n");
  464. fprintf(stdout,"\t\t\t\t\t</Default>\n");
  465. fprintf(stdout,"\t\t\t\t\t<Supported>\n");
  466. fprintf(stdout,"\t\t\t\t\t\t<ows:UOM>meters</ows:UOM>\n");
  467. fprintf(stdout,"\t\t\t\t\t</Supported>\n");
  468. fprintf(stdout,"\t\t\t\t\t</UOMs>\n");
  469. }
  470. if(num_choices == 0 || choices == NULL)
  471. fprintf(stdout,"\t\t\t\t\t<ows:AnyValue/>\n");
  472. else
  473. {
  474. fprintf(stdout,"\t\t\t\t\t<ows:AllowedValues>\n");
  475. if(type == TYPE_RANGE && num_choices > 1)
  476. {
  477. fprintf(stdout,"\t\t\t\t\t\t<ows:Range ows:rangeClosure=\"%s\">\n", "0");
  478. fprintf(stdout,"\t\t\t\t\t\t\t<ows:MinimumValue>%s</ows:MinimumValue>\n", choices[0]);
  479. fprintf(stdout,"\t\t\t\t\t\t\t<ows:MaximumValue>%s</ows:MaximumValue>\n", choices[1]);
  480. fprintf(stdout,"\t\t\t\t\t\t</ows:Range>\n");
  481. }
  482. else
  483. {
  484. for(i = 0; i < num_choices; i++)
  485. {
  486. fprintf(stdout,"\t\t\t\t\t\t<ows:Value>");
  487. print_escaped_for_xml(stdout, choices[i]);
  488. fprintf(stdout,"</ows:Value>\n");
  489. }
  490. }
  491. fprintf(stdout,"\t\t\t\t\t</ows:AllowedValues>\n");
  492. }
  493. if(default_value)
  494. {
  495. fprintf(stdout,"\t\t\t\t\t<DefaultValue>");
  496. print_escaped_for_xml(stdout, default_value);
  497. fprintf(stdout,"</DefaultValue>\n");
  498. }
  499. fprintf(stdout,"\t\t\t\t</LiteralData>\n");
  500. if(inout_type == WPS_INPUT)
  501. fprintf(stdout,"\t\t\t</Input>\n");
  502. else if(inout_type == WPS_OUTPUT)
  503. fprintf(stdout,"\t\t\t</Output>\n");
  504. }
  505. /* ************************************************************************** */
  506. static void wps_print_mimetype_text_plain(void)
  507. {
  508. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  509. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>text/plain</MimeType>\n");
  510. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  511. }
  512. /* ************************************************************************** */
  513. static void wps_print_mimetype_raster_tiff(void)
  514. {
  515. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  516. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>image/tiff</MimeType>\n");
  517. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  518. }
  519. /* ************************************************************************** */
  520. static void wps_print_mimetype_raster_png(void)
  521. {
  522. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  523. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>image/png</MimeType>\n");
  524. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  525. }
  526. /* *** Native GRASS raster format urn:grass:raster:location/mapset/raster *** */
  527. static void wps_print_mimetype_raster_grass_binary(void)
  528. {
  529. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  530. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/grass-raster-binary</MimeType>\n");
  531. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  532. }
  533. /* *** GRASS raster maps exported via r.out.ascii ************************** */
  534. static void wps_print_mimetype_raster_grass_ascii(void)
  535. {
  536. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  537. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/grass-raster-ascii</MimeType>\n");
  538. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  539. }
  540. /* ************************************************************************** */
  541. static void wps_print_mimetype_vector_gml310(void)
  542. {
  543. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  544. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>text/xml</MimeType>\n");
  545. fprintf(stdout,"\t\t\t\t\t\t\t<Encoding>UTF-8</Encoding>\n");
  546. fprintf(stdout,"\t\t\t\t\t\t\t<Schema>http://schemas.opengis.net/gml/3.1.0/polygon.xsd</Schema>\n");
  547. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  548. }
  549. /* *** GRASS vector format exported via v.out.ascii ************************** */
  550. static void wps_print_mimetype_vector_grass_ascii(void)
  551. {
  552. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  553. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/grass-vector-ascii</MimeType>\n");
  554. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  555. }
  556. /* *** Native GRASS vector format urn:grass:vector:location/mapset/vector *** */
  557. static void wps_print_mimetype_vector_grass_binary(void)
  558. {
  559. fprintf(stdout,"\t\t\t\t\t\t<Format>\n");
  560. fprintf(stdout,"\t\t\t\t\t\t\t<MimeType>application/grass-vector-binary</MimeType>\n");
  561. fprintf(stdout,"\t\t\t\t\t\t</Format>\n");
  562. }