parser_standard_options.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. /*!
  2. \file lib/gis/parser_standard_options.c
  3. \brief GIS Library - Argument parsing functions (standard options)
  4. (C) 2001-2013 by the GRASS Development Team
  5. This program is free software under the GNU General Public License
  6. (>=v2). Read the file COPYING that comes with GRASS for details.
  7. \author Original author CERL
  8. \author Soeren Gebbert added Dec. 2009 WPS process_description document
  9. \author Luca Delucchi added Aug 2011 G_OPT_M_DIR
  10. */
  11. #include <grass/gis.h>
  12. #include <grass/glocale.h>
  13. #include "parser_local_proto.h"
  14. /*!
  15. \brief Create standardised Option structure.
  16. This function will create a standardised Option structure defined by
  17. parameter <i>opt</i>.
  18. Valid parameters are defined by the STD_OPT enum in the file gis.h.
  19. A list of valid parameter values sorted to groups is bellow.
  20. This function allocates memory for the Option structure and returns a
  21. pointer to this memory.
  22. If an invalid parameter was specified a empty Option structure will
  23. be returned (not NULL).
  24. \par List of STD_OPT values sorted by module group
  25. - database:
  26. - G_OPT_DB_SQL
  27. - G_OPT_DB_WHERE
  28. - G_OPT_DB_TABLE
  29. - G_OPT_DB_DRIVER
  30. - G_OPT_DB_DATABASE
  31. - G_OPT_DB_SCHEMA
  32. - G_OPT_DB_COLUMN
  33. - G_OPT_DB_COLUMNS
  34. - G_OPT_DB_KEYCOLUMN
  35. - imagery:
  36. - G_OPT_I_GROUP
  37. - G_OPT_I_SUBGROUP
  38. - raster:
  39. - G_OPT_R_INPUT
  40. - G_OPT_R_INPUTS
  41. - G_OPT_R_OUTPUT
  42. - G_OPT_R_MAP
  43. - G_OPT_R_MAPS
  44. - G_OPT_R_BASE
  45. - G_OPT_R_COVER
  46. - G_OPT_R_ELEV
  47. - G_OPT_R_ELEVS
  48. - G_OPT_R_INTERP_TYPE
  49. - raster3d:
  50. - G_OPT_R3_INPUT
  51. - G_OPT_R3_INPUTS
  52. - G_OPT_R3_OUTPUT
  53. - G_OPT_R3_MAP
  54. - G_OPT_R3_MAPS
  55. - vector:
  56. - G_OPT_V_INPUT
  57. - G_OPT_V_INPUTS
  58. - G_OPT_V_OUTPUT
  59. - G_OPT_V_MAP
  60. - G_OPT_V_MAPS
  61. - G_OPT_V_TYPE
  62. - G_OPT_V_FIELD
  63. - G_OPT_V_FIELD_ALL
  64. - G_OPT_V_CAT
  65. - G_OPT_V_CATS
  66. - G_OPT_V_ID
  67. - G_OPT_V_IDS
  68. - files
  69. - G_OPT_F_INPUT
  70. - G_OPT_F_OUTPUT
  71. - G_OPT_F_SEP
  72. - colors
  73. - G_OPT_C_FG
  74. - G_OPT_C_BG
  75. - misc
  76. - G_OPT_M_UNITS
  77. - G_OPT_M_DATATYPE
  78. - G_OPT_M_MAPSET
  79. - G_OPT_M_COORDS
  80. - G_OPT_M_COLR
  81. - G_OPT_M_DIR
  82. - temporal GIS framework
  83. - G_OPT_STDS_INPUT
  84. - G_OPT_STDS_INPUTS
  85. - G_OPT_STDS_OUTPUT
  86. - G_OPT_STRDS_INPUT
  87. - G_OPT_STRDS_INPUTS
  88. - G_OPT_STRDS_OUTPUT
  89. - G_OPT_STR3DS_INPUT
  90. - G_OPT_STR3DS_INPUTS
  91. - G_OPT_STR3DS_OUTPUT
  92. - G_OPT_STVDS_INPUT
  93. - G_OPT_STVDS_INPUTS
  94. - G_OPT_STVDS_OUTPUT
  95. - G_OPT_MAP_INPUT
  96. - G_OPT_MAP_INPUTS
  97. - G_OPT_STDS_TYPE
  98. - G_OPT_MAP_TYPE
  99. - G_OPT_T_TYPE
  100. - G_OPT_T_WHERE
  101. \param opt type of Option struct to create specified by STD_OPT enum
  102. \return pointer to an Option struct
  103. */
  104. struct Option *G_define_standard_option(int opt)
  105. {
  106. struct Option *Opt;
  107. Opt = G_define_option();
  108. switch (opt) {
  109. case G_OPT_DB_SQL:
  110. Opt->key = "sql";
  111. Opt->type = TYPE_STRING;
  112. Opt->key_desc = "sql_query";
  113. Opt->required = NO;
  114. Opt->label = _("SQL select statement");
  115. Opt->description =
  116. _("For example: 'select * from rybniky where kapri = 'hodne'");
  117. break;
  118. case G_OPT_DB_WHERE:
  119. Opt->key = "where";
  120. Opt->type = TYPE_STRING;
  121. Opt->key_desc = "sql_query";
  122. Opt->required = NO;
  123. Opt->label = _("WHERE conditions of SQL statement without 'where' keyword");
  124. Opt->description = _("Example: income < 1000 and inhab >= 10000");
  125. break;
  126. case G_OPT_DB_TABLE:
  127. Opt->key = "table";
  128. Opt->type = TYPE_STRING;
  129. Opt->key_desc = "name";
  130. Opt->required = NO;
  131. Opt->multiple = NO;
  132. Opt->description = _("Name of attribute table");
  133. Opt->gisprompt = "old,dbtable,dbtable";
  134. break;
  135. case G_OPT_DB_DRIVER:
  136. Opt->key = "driver";
  137. Opt->type = TYPE_STRING;
  138. Opt->key_desc = "name";
  139. Opt->required = NO;
  140. Opt->multiple = NO;
  141. Opt->description = _("Name of database driver");
  142. Opt->gisprompt = "old,dbdriver,dbdriver";
  143. break;
  144. case G_OPT_DB_DATABASE:
  145. Opt->key = "database";
  146. Opt->type = TYPE_STRING;
  147. Opt->key_desc = "name";
  148. Opt->required = NO;
  149. Opt->multiple = NO;
  150. Opt->description = _("Name of database");
  151. Opt->gisprompt = "old,dbname,dbname";
  152. break;
  153. case G_OPT_DB_SCHEMA:
  154. Opt->key = "schema";
  155. Opt->type = TYPE_STRING;
  156. Opt->key_desc = "name";
  157. Opt->required = NO;
  158. Opt->multiple = NO;
  159. Opt->label = _("Database schema");
  160. Opt->description = _("Do not use this option if schemas "
  161. "are not supported by driver/database server");
  162. break;
  163. case G_OPT_DB_COLUMN:
  164. Opt->key = "column";
  165. Opt->type = TYPE_STRING;
  166. Opt->key_desc = "name";
  167. Opt->required = NO;
  168. Opt->multiple = NO;
  169. Opt->description = _("Name of attribute column");
  170. Opt->gisprompt = "old,dbcolumn,dbcolumn";
  171. break;
  172. case G_OPT_DB_COLUMNS:
  173. Opt->key = "columns";
  174. Opt->type = TYPE_STRING;
  175. Opt->key_desc = "name";
  176. Opt->required = NO;
  177. Opt->multiple = YES;
  178. Opt->description = _("Name of attribute column(s)");
  179. Opt->gisprompt = "old,dbcolumn,dbcolumn";
  180. break;
  181. case G_OPT_DB_KEYCOLUMN:
  182. Opt->key = "key";
  183. Opt->type = TYPE_STRING;
  184. Opt->key_desc = "name";
  185. Opt->required = NO;
  186. Opt->multiple = NO;
  187. Opt->label = _("Name of key column");
  188. Opt->description = _("Must refer to an integer column");
  189. /* Opt->gisprompt = "old,dbcolumn,dbcolumn"; */
  190. Opt->answer = GV_KEY_COLUMN;
  191. break;
  192. /* imagery group */
  193. case G_OPT_I_GROUP:
  194. Opt->key = "group";
  195. Opt->type = TYPE_STRING;
  196. Opt->key_desc = "name";
  197. Opt->required = YES;
  198. Opt->gisprompt = "old,group,group";
  199. Opt->description = _("Name of input imagery group");
  200. break;
  201. case G_OPT_I_SUBGROUP:
  202. Opt->key = "subgroup";
  203. Opt->type = TYPE_STRING;
  204. Opt->key_desc = "name";
  205. Opt->required = YES;
  206. Opt->gisprompt = "old,subgroup,subgroup";
  207. Opt->description = _("Name of input imagery subgroup");
  208. break;
  209. /* raster maps */
  210. case G_OPT_R_INPUT:
  211. Opt->key = "input";
  212. Opt->type = TYPE_STRING;
  213. Opt->key_desc = "name";
  214. Opt->required = YES;
  215. Opt->gisprompt = "old,cell,raster";
  216. Opt->description = _("Name of input raster map");
  217. break;
  218. case G_OPT_R_INPUTS:
  219. Opt->key = "input";
  220. Opt->type = TYPE_STRING;
  221. Opt->key_desc = "name";
  222. Opt->required = YES;
  223. Opt->multiple = YES;
  224. Opt->gisprompt = "old,cell,raster";
  225. Opt->description = _("Name of input raster map(s)");
  226. break;
  227. case G_OPT_R_OUTPUT:
  228. Opt->key = "output";
  229. Opt->type = TYPE_STRING;
  230. Opt->key_desc = "name";
  231. Opt->required = YES;
  232. Opt->gisprompt = "new,cell,raster";
  233. Opt->description = _("Name for output raster map");
  234. break;
  235. case G_OPT_R_MAP:
  236. Opt->key = "map";
  237. Opt->type = TYPE_STRING;
  238. Opt->key_desc = "name";
  239. Opt->required = YES;
  240. Opt->gisprompt = "old,cell,raster";
  241. Opt->description = _("Name of raster map");
  242. break;
  243. case G_OPT_R_MAPS:
  244. Opt->key = "map";
  245. Opt->type = TYPE_STRING;
  246. Opt->key_desc = "name";
  247. Opt->required = YES;
  248. Opt->multiple = YES;
  249. Opt->gisprompt = "old,cell,raster";
  250. Opt->description = _("Name of raster map(s)");
  251. break;
  252. case G_OPT_R_BASE:
  253. Opt->key = "base";
  254. Opt->type = TYPE_STRING;
  255. Opt->key_desc = "name";
  256. Opt->required = YES;
  257. Opt->gisprompt = "old,cell,raster";
  258. Opt->description = _("Name of base raster map");
  259. break;
  260. case G_OPT_R_COVER:
  261. Opt->key = "cover";
  262. Opt->type = TYPE_STRING;
  263. Opt->key_desc = "name";
  264. Opt->required = YES;
  265. Opt->gisprompt = "old,cell,raster";
  266. Opt->description = _("Name of cover raster map");
  267. break;
  268. case G_OPT_R_ELEV:
  269. Opt->key = "elevation";
  270. Opt->type = TYPE_STRING;
  271. Opt->key_desc = "name";
  272. Opt->required = YES;
  273. Opt->gisprompt = "old,cell,raster";
  274. Opt->description = _("Name of input elevation raster map");
  275. break;
  276. case G_OPT_R_ELEVS:
  277. Opt->key = "elevation";
  278. Opt->type = TYPE_STRING;
  279. Opt->key_desc = "name";
  280. Opt->required = YES;
  281. Opt->multiple = YES;
  282. Opt->gisprompt = "old,cell,raster";
  283. Opt->description = _("Name of input elevation raster map(s)");
  284. break;
  285. case G_OPT_R_INTERP_TYPE:
  286. Opt->key = "method";
  287. Opt->type = TYPE_STRING;
  288. Opt->required = NO;
  289. Opt->description = _("Sampling interpolation method");
  290. Opt->options = "nearest,linear,cubic";
  291. G_asprintf((char **) &(Opt->descriptions),
  292. "nearest;%s;linear;%s;cubic;%s",
  293. _("Nearest-neighbor interpolation"),
  294. _("Linear interpolation"),
  295. _("Cubic interpolation"));
  296. break;
  297. /*g3d maps */
  298. case G_OPT_R3_INPUT:
  299. Opt->key = "input";
  300. Opt->type = TYPE_STRING;
  301. Opt->key_desc = "name";
  302. Opt->required = YES;
  303. Opt->gisprompt = "old,grid3,3d-raster";
  304. Opt->description = _("Name of input 3D raster map");
  305. break;
  306. case G_OPT_R3_INPUTS:
  307. Opt->key = "input";
  308. Opt->type = TYPE_STRING;
  309. Opt->key_desc = "name";
  310. Opt->required = YES;
  311. Opt->multiple = YES;
  312. Opt->gisprompt = "old,grid3,3d-raster";
  313. Opt->description = _("Name of input 3D raster map(s)");
  314. break;
  315. case G_OPT_R3_OUTPUT:
  316. Opt->key = "output";
  317. Opt->type = TYPE_STRING;
  318. Opt->key_desc = "name";
  319. Opt->required = YES;
  320. Opt->gisprompt = "new,grid3,3d-raster";
  321. Opt->description = _("Name for output 3D raster map");
  322. break;
  323. case G_OPT_R3_MAP:
  324. Opt->key = "map";
  325. Opt->type = TYPE_STRING;
  326. Opt->key_desc = "name";
  327. Opt->required = YES;
  328. Opt->gisprompt = "old,grid3,3d-raster";
  329. Opt->description = _("Name of 3D raster map");
  330. break;
  331. case G_OPT_R3_MAPS:
  332. Opt->key = "map";
  333. Opt->type = TYPE_STRING;
  334. Opt->key_desc = "name";
  335. Opt->required = YES;
  336. Opt->multiple = YES;
  337. Opt->gisprompt = "old,grid3,3d-raster";
  338. Opt->description = _("Name of 3D raster map(s)");
  339. break;
  340. case G_OPT_R3_TYPE:
  341. Opt->key = "type";
  342. Opt->type = TYPE_STRING;
  343. Opt->required = NO;
  344. Opt->multiple = NO;
  345. Opt->answer = "default";
  346. Opt->options = "default,double,float";
  347. Opt->description = _("Data type used in the output raster3d map");
  348. break;
  349. case G_OPT_R3_PRECISION:
  350. Opt->key = "precision";
  351. Opt->type = TYPE_STRING;
  352. Opt->required = NO;
  353. Opt->multiple = NO;
  354. Opt->answer = "default";
  355. Opt->description =
  356. _("Number of digits used as mantissa in the internal map storage, 0 -23 for float, 0 - 52 for double, max or default");
  357. break;
  358. case G_OPT_R3_COMPRESSION:
  359. Opt->key = "compression";
  360. Opt->type = TYPE_STRING;
  361. Opt->required = NO;
  362. Opt->multiple = NO;
  363. Opt->answer = "default";
  364. Opt->options = "default,zip,none";
  365. Opt->description =
  366. _("The compression method used in the output raster3d map");
  367. break;
  368. case G_OPT_R3_TILE_DIMENSION:
  369. Opt->key = "tiledimension";
  370. Opt->type = TYPE_STRING;
  371. Opt->required = NO;
  372. Opt->multiple = NO;
  373. Opt->key_desc = "XxYxZ";
  374. Opt->answer = "default";
  375. Opt->description =
  376. _("The dimensions of the tiles used in the output raster3d map (XxYxZ or default: 16x16x8)");
  377. break;
  378. /*vector maps */
  379. case G_OPT_V_INPUT:
  380. Opt->key = "input";
  381. Opt->type = TYPE_STRING;
  382. Opt->key_desc = "name";
  383. Opt->required = YES;
  384. Opt->gisprompt = "old,vector,vector";
  385. Opt->label = _("Name of input vector map");
  386. Opt->description = _("Or data source for direct OGR access");
  387. break;
  388. case G_OPT_V_INPUTS:
  389. Opt->key = "input";
  390. Opt->type = TYPE_STRING;
  391. Opt->key_desc = "name";
  392. Opt->required = YES;
  393. Opt->multiple = YES;
  394. Opt->gisprompt = "old,vector,vector";
  395. Opt->label = _("Name of input vector map(s)");
  396. Opt->description = _("Or data source(s) for direct OGR access");
  397. break;
  398. case G_OPT_V_OUTPUT:
  399. Opt->key = "output";
  400. Opt->type = TYPE_STRING;
  401. Opt->key_desc = "name";
  402. Opt->required = YES;
  403. Opt->gisprompt = "new,vector,vector";
  404. Opt->description = _("Name for output vector map");
  405. break;
  406. case G_OPT_V_MAP:
  407. Opt->key = "map";
  408. Opt->type = TYPE_STRING;
  409. Opt->key_desc = "name";
  410. Opt->required = YES;
  411. Opt->gisprompt = "old,vector,vector";
  412. Opt->label = _("Name of vector map");
  413. Opt->description = _("Or data source for direct OGR access");
  414. break;
  415. case G_OPT_V_MAPS:
  416. Opt->key = "map";
  417. Opt->type = TYPE_STRING;
  418. Opt->key_desc = "name";
  419. Opt->required = YES;
  420. Opt->multiple = YES;
  421. Opt->gisprompt = "old,vector,vector";
  422. Opt->description = _("Name of vector map(s)");
  423. break;
  424. case G_OPT_V_TYPE:
  425. Opt->key = "type";
  426. Opt->type = TYPE_STRING;
  427. Opt->required = NO;
  428. Opt->multiple = YES;
  429. Opt->answer = "point,line,boundary,centroid,area";
  430. Opt->options = "point,line,boundary,centroid,area";
  431. Opt->description = _("Feature type");
  432. break;
  433. case G_OPT_V3_TYPE:
  434. Opt->key = "type";
  435. Opt->type = TYPE_STRING;
  436. Opt->required = NO;
  437. Opt->multiple = YES;
  438. Opt->answer = "point,line,boundary,centroid,area,face,kernel";
  439. Opt->options = "point,line,boundary,centroid,area,face,kernel";
  440. Opt->description = _("Feature type");
  441. break;
  442. case G_OPT_V_FIELD:
  443. Opt->key = "layer";
  444. Opt->type = TYPE_STRING;
  445. Opt->required = NO;
  446. Opt->answer = "1";
  447. Opt->label = _("Layer number or name");
  448. Opt->description =
  449. _("Vector features can have category values in different layers."
  450. " This number determines which layer to use. "
  451. "When used with direct OGR access this is the layer name.");
  452. Opt->gisprompt = "old,layer,layer";
  453. break;
  454. case G_OPT_V_FIELD_ALL:
  455. Opt->key = "layer";
  456. Opt->type = TYPE_STRING;
  457. Opt->required = NO;
  458. Opt->answer = "-1";
  459. Opt->label = _("Layer number or name ('-1' for all layers)");
  460. Opt->description =
  461. _("A single vector map can be connected to multiple database "
  462. "tables. This number determines which table to use. "
  463. "When used with direct OGR access this is the layer name.");
  464. Opt->gisprompt = "old,layer_all,layer";
  465. break;
  466. case G_OPT_V_CAT:
  467. Opt->key = "cat";
  468. Opt->type = TYPE_INTEGER;
  469. Opt->required = NO;
  470. Opt->description = _("Category value");
  471. break;
  472. case G_OPT_V_CATS:
  473. Opt->key = "cats";
  474. Opt->type = TYPE_STRING;
  475. Opt->key_desc = "range";
  476. Opt->required = NO;
  477. Opt->label = _("Category values");
  478. Opt->description = _("Example: 1,3,7-9,13");
  479. break;
  480. case G_OPT_V_ID:
  481. Opt->key = "id";
  482. Opt->type = TYPE_INTEGER;
  483. Opt->required = NO;
  484. Opt->description = _("Feature id");
  485. break;
  486. case G_OPT_V_IDS:
  487. Opt->key = "ids";
  488. Opt->type = TYPE_STRING;
  489. Opt->key_desc = "range";
  490. Opt->required = NO;
  491. Opt->label = _("Feature ids");
  492. Opt->description = _("Example: 1,3,7-9,13");
  493. break;
  494. /* files */
  495. case G_OPT_F_INPUT:
  496. Opt->key = "input";
  497. Opt->type = TYPE_STRING;
  498. Opt->key_desc = "name";
  499. Opt->required = YES;
  500. Opt->gisprompt = "old,file,file";
  501. Opt->description = _("Name of input file");
  502. break;
  503. case G_OPT_F_OUTPUT:
  504. Opt->key = "output";
  505. Opt->type = TYPE_STRING;
  506. Opt->key_desc = "name";
  507. Opt->required = YES;
  508. Opt->gisprompt = "new,file,file";
  509. Opt->description = _("Name for output file");
  510. break;
  511. case G_OPT_F_SEP:
  512. Opt->key = "separator";
  513. Opt->type = TYPE_STRING;
  514. Opt->key_desc = "character";
  515. Opt->required = NO;
  516. Opt->answer = "|";
  517. Opt->label = _("Field separator");
  518. Opt->description = _("Special characters: newline, space, comma, tab");
  519. break;
  520. /* colors */
  521. case G_OPT_C_FG:
  522. Opt->key = "color";
  523. Opt->type = TYPE_STRING;
  524. Opt->key_desc = "name";
  525. Opt->required = NO;
  526. Opt->answer = DEFAULT_FG_COLOR;
  527. Opt->gisprompt = "old,color,color";
  528. Opt->label = _("Color");
  529. Opt->description = _("Either a standard color name or R:G:B triplet");
  530. break;
  531. case G_OPT_C_BG:
  532. Opt->key = "bgcolor";
  533. Opt->type = TYPE_STRING;
  534. Opt->key_desc = "name";
  535. Opt->required = NO;
  536. Opt->answer = DEFAULT_BG_COLOR;
  537. Opt->gisprompt = "old,color_none,color";
  538. Opt->label = _("Background color");
  539. Opt->description =
  540. _("Either a standard GRASS color, R:G:B triplet, or \"none\"");
  541. break;
  542. /* misc */
  543. case G_OPT_M_DIR:
  544. Opt->key = "input";
  545. Opt->type = TYPE_STRING;
  546. Opt->key_desc = "name";
  547. Opt->required = YES;
  548. Opt->gisprompt = "old,dir,dir";
  549. Opt->description = _("Name to input directory");
  550. break;
  551. case G_OPT_M_UNITS:
  552. Opt->key = "units";
  553. Opt->type = TYPE_STRING;
  554. Opt->required = NO;
  555. Opt->multiple = NO;
  556. Opt->options =
  557. "miles,feet,meters,kilometers,acres,hectares";
  558. Opt->description = _("Units");
  559. break;
  560. case G_OPT_M_DATATYPE:
  561. Opt->key = "type";
  562. Opt->key_desc = "datatype";
  563. Opt->type = TYPE_STRING;
  564. Opt->required = YES;
  565. Opt->multiple = YES;
  566. Opt->description = _("Data type(s)");
  567. break;
  568. case G_OPT_M_MAPSET:
  569. Opt->key = "mapset";
  570. Opt->type = TYPE_STRING;
  571. Opt->required = NO;
  572. Opt->multiple = NO;
  573. Opt->key_desc = "name";
  574. Opt->gisprompt = "old,mapset,mapset";
  575. Opt->label = _("Name of mapset (default: current search path)");
  576. Opt->description = _("'.' for current mapset");
  577. break;
  578. case G_OPT_M_COORDS:
  579. Opt->key = "coordinates";
  580. Opt->type = TYPE_DOUBLE;
  581. Opt->required = NO;
  582. Opt->multiple = NO;
  583. Opt->key_desc = "east,north";
  584. Opt->gisprompt = "old,coords,coords";
  585. Opt->description = _("Coordinates");
  586. break;
  587. case G_OPT_M_COLR:
  588. Opt->key = "color";
  589. Opt->key_desc = "style";
  590. Opt->type = TYPE_STRING;
  591. Opt->required = NO;
  592. Opt->options = G_color_rules_options();
  593. Opt->description = _("Name of color table");
  594. Opt->descriptions = G_color_rules_descriptions();
  595. Opt->gisprompt = "old,colortable,colortable";
  596. break;
  597. /* Spatio-temporal modules of the temporal GIS framework */
  598. case G_OPT_STDS_INPUT:
  599. Opt->key = "input";
  600. Opt->type = TYPE_STRING;
  601. Opt->key_desc = "name";
  602. Opt->required = YES;
  603. Opt->gisprompt = "old,stds,stds";
  604. Opt->description = _("Name of the input space time dataset");
  605. break;
  606. case G_OPT_STDS_INPUTS:
  607. Opt->key = "inputs";
  608. Opt->type = TYPE_STRING;
  609. Opt->key_desc = "name";
  610. Opt->required = YES;
  611. Opt->multiple = YES;
  612. Opt->gisprompt = "old,stds,stds";
  613. Opt->description = _("Name of the input space time datasets");
  614. break;
  615. case G_OPT_STDS_OUTPUT:
  616. Opt->key = "output";
  617. Opt->type = TYPE_STRING;
  618. Opt->key_desc = "name";
  619. Opt->required = YES;
  620. Opt->gisprompt = "new,stds,stds";
  621. Opt->description = _("Name of the output space time dataset");
  622. break;
  623. case G_OPT_STRDS_INPUT:
  624. Opt->key = "input";
  625. Opt->type = TYPE_STRING;
  626. Opt->key_desc = "name";
  627. Opt->required = YES;
  628. Opt->gisprompt = "old,strds,strds";
  629. Opt->description = _("Name of the input space time raster dataset");
  630. break;
  631. case G_OPT_STRDS_INPUTS:
  632. Opt->key = "inputs";
  633. Opt->type = TYPE_STRING;
  634. Opt->key_desc = "name";
  635. Opt->required = YES;
  636. Opt->multiple = YES;
  637. Opt->gisprompt = "old,strds,strds";
  638. Opt->description = _("Name of the input space time raster datasets");
  639. break;
  640. case G_OPT_STRDS_OUTPUT:
  641. Opt->key = "output";
  642. Opt->type = TYPE_STRING;
  643. Opt->key_desc = "name";
  644. Opt->required = YES;
  645. Opt->gisprompt = "new,strds,strds";
  646. Opt->description = _("Name of the output space time raster dataset");
  647. break;
  648. case G_OPT_STVDS_INPUT:
  649. Opt->key = "input";
  650. Opt->type = TYPE_STRING;
  651. Opt->key_desc = "name";
  652. Opt->required = YES;
  653. Opt->gisprompt = "old,stvds,stvds";
  654. Opt->description = _("Name of the input space time vector dataset");
  655. break;
  656. case G_OPT_STVDS_INPUTS:
  657. Opt->key = "inputs";
  658. Opt->type = TYPE_STRING;
  659. Opt->key_desc = "name";
  660. Opt->required = YES;
  661. Opt->multiple = YES;
  662. Opt->gisprompt = "old,stvds,stvds";
  663. Opt->description = _("Name of the input space time vector datasets");
  664. break;
  665. case G_OPT_STVDS_OUTPUT:
  666. Opt->key = "output";
  667. Opt->type = TYPE_STRING;
  668. Opt->key_desc = "name";
  669. Opt->required = YES;
  670. Opt->gisprompt = "new,stvds,stvds";
  671. Opt->description = _("Name of the output space time vector dataset");
  672. break;
  673. case G_OPT_STR3DS_INPUT:
  674. Opt->key = "input";
  675. Opt->type = TYPE_STRING;
  676. Opt->key_desc = "name";
  677. Opt->required = YES;
  678. Opt->gisprompt = "old,str3ds,str3ds";
  679. Opt->description = _("Name of the input space time raster3d dataset");
  680. break;
  681. case G_OPT_STR3DS_INPUTS:
  682. Opt->key = "inputs";
  683. Opt->type = TYPE_STRING;
  684. Opt->key_desc = "name";
  685. Opt->required = YES;
  686. Opt->multiple = YES;
  687. Opt->gisprompt = "old,str3ds,str3ds";
  688. Opt->description = _("Name of the input space time raster3d datasets");
  689. break;
  690. case G_OPT_STR3DS_OUTPUT:
  691. Opt->key = "output";
  692. Opt->type = TYPE_STRING;
  693. Opt->key_desc = "name";
  694. Opt->required = YES;
  695. Opt->gisprompt = "new,str3ds,str3ds";
  696. Opt->description = _("Name of the output space time raster3d dataset");
  697. break;
  698. case G_OPT_STDS_TYPE:
  699. Opt->key = "type";
  700. Opt->type = TYPE_STRING;
  701. Opt->key_desc = "name";
  702. Opt->required = NO;
  703. Opt->answer = "strds";
  704. Opt->options = "strds,stvds,str3ds";
  705. Opt->description = _("Type of the input space time dataset");
  706. break;
  707. case G_OPT_MAP_INPUT:
  708. Opt->key = "map";
  709. Opt->type = TYPE_STRING;
  710. Opt->key_desc = "name";
  711. Opt->required = YES;
  712. Opt->gisprompt = "old,map,map";
  713. Opt->description = _("Name of the input map");
  714. break;
  715. case G_OPT_MAP_INPUTS:
  716. Opt->key = "maps";
  717. Opt->type = TYPE_STRING;
  718. Opt->key_desc = "name";
  719. Opt->required = YES;
  720. Opt->multiple = YES;
  721. Opt->gisprompt = "old,map,map";
  722. Opt->description = _("Name of the input maps");
  723. break;
  724. case G_OPT_MAP_TYPE:
  725. Opt->key = "type";
  726. Opt->type = TYPE_STRING;
  727. Opt->key_desc = "name";
  728. Opt->required = NO;
  729. Opt->answer = "rast";
  730. Opt->options = "rast,vect,rast3d";
  731. Opt->description = _("Type of the input map");
  732. break;
  733. case G_OPT_T_TYPE:
  734. Opt->key = "temporaltype";
  735. Opt->type = TYPE_STRING;
  736. Opt->key_desc = "name";
  737. Opt->required = NO;
  738. Opt->answer = "absolute";
  739. Opt->options = "absolute,relative";
  740. Opt->description = _("The temporal type of the space time dataset");
  741. break;
  742. case G_OPT_T_WHERE:
  743. Opt->key = "where";
  744. Opt->type = TYPE_STRING;
  745. Opt->key_desc = "sql_query";
  746. Opt->required = NO;
  747. Opt->label = _("WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework");
  748. Opt->description = _("Example: start_time > '2001-01-01 12:30:00'");
  749. break;
  750. case G_OPT_T_SAMPLE:
  751. Opt->key = "sampling";
  752. Opt->type = TYPE_STRING;
  753. Opt->key_desc = "name";
  754. Opt->required = NO;
  755. Opt->multiple = YES;
  756. Opt->answer = "start";
  757. Opt->options = "start,during,overlap,contain,equal,follows,precedes";
  758. Opt->description = _("The method to be used for sampling the input dataset");
  759. break;
  760. }
  761. return Opt;
  762. }
  763. /*!
  764. \brief Create standardised Flag structure.
  765. This function will create a standardised Flag structure defined by
  766. parameter <i>flag</i>. A list of valid parameters bellow. It
  767. allocates memory for the Flag structure and returns a pointer to
  768. this memory.
  769. If an invalid parameter was specified a empty Flag structure will be
  770. returned (not NULL).
  771. - G_FLG_V_TABLE (do not create attribute table)
  772. - G_FLG_V_TOPO (do not build topology)
  773. \param flag type of Flag struct to create specified by STD_FLG enum.
  774. \return pointer to an Flag struct
  775. */
  776. struct Flag *G_define_standard_flag(int flag)
  777. {
  778. struct Flag *Flg;
  779. Flg = G_define_flag();
  780. switch (flag) {
  781. case G_FLG_V_TABLE:
  782. Flg->key = 't';
  783. Flg->description = _("Do not create attribute table");
  784. break;
  785. case G_FLG_V_TOPO:
  786. Flg->key = 'b';
  787. Flg->description = _("Do not build topology");
  788. break;
  789. }
  790. return Flg;
  791. }