parser_standard_options.c 22 KB

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