parser_standard_options.c 23 KB

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