parser_wps.c 23 KB

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