parser_standard_options.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  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_OUTPUTS:
  237. Opt->key = "output";
  238. Opt->type = TYPE_STRING;
  239. Opt->key_desc = "name";
  240. Opt->required = YES;
  241. Opt->multiple = YES;
  242. Opt->gisprompt = "new,cell,raster";
  243. Opt->description = _("Name for output raster map(s)");
  244. break;
  245. case G_OPT_R_MAP:
  246. Opt->key = "map";
  247. Opt->type = TYPE_STRING;
  248. Opt->key_desc = "name";
  249. Opt->required = YES;
  250. Opt->gisprompt = "old,cell,raster";
  251. Opt->description = _("Name of raster map");
  252. break;
  253. case G_OPT_R_MAPS:
  254. Opt->key = "map";
  255. Opt->type = TYPE_STRING;
  256. Opt->key_desc = "name";
  257. Opt->required = YES;
  258. Opt->multiple = YES;
  259. Opt->gisprompt = "old,cell,raster";
  260. Opt->description = _("Name of raster map(s)");
  261. break;
  262. case G_OPT_R_BASE:
  263. Opt->key = "base";
  264. Opt->type = TYPE_STRING;
  265. Opt->key_desc = "name";
  266. Opt->required = YES;
  267. Opt->gisprompt = "old,cell,raster";
  268. Opt->description = _("Name of base raster map");
  269. break;
  270. case G_OPT_R_COVER:
  271. Opt->key = "cover";
  272. Opt->type = TYPE_STRING;
  273. Opt->key_desc = "name";
  274. Opt->required = YES;
  275. Opt->gisprompt = "old,cell,raster";
  276. Opt->description = _("Name of cover raster map");
  277. break;
  278. case G_OPT_R_ELEV:
  279. Opt->key = "elevation";
  280. Opt->type = TYPE_STRING;
  281. Opt->key_desc = "name";
  282. Opt->required = YES;
  283. Opt->gisprompt = "old,cell,raster";
  284. Opt->description = _("Name of input elevation raster map");
  285. break;
  286. case G_OPT_R_ELEVS:
  287. Opt->key = "elevation";
  288. Opt->type = TYPE_STRING;
  289. Opt->key_desc = "name";
  290. Opt->required = YES;
  291. Opt->multiple = YES;
  292. Opt->gisprompt = "old,cell,raster";
  293. Opt->description = _("Name of input elevation raster map(s)");
  294. break;
  295. case G_OPT_R_INTERP_TYPE:
  296. Opt->key = "method";
  297. Opt->type = TYPE_STRING;
  298. Opt->required = NO;
  299. Opt->description = _("Sampling interpolation method");
  300. Opt->options = "nearest,bilinear,bicubic";
  301. G_asprintf((char **) &(Opt->descriptions),
  302. "nearest;%s;bilinear;%s;bicubic;%s",
  303. _("Nearest-neighbor interpolation"),
  304. _("Bilinear interpolation"),
  305. _("Bicubic interpolation"));
  306. break;
  307. /*g3d maps */
  308. case G_OPT_R3_INPUT:
  309. Opt->key = "input";
  310. Opt->type = TYPE_STRING;
  311. Opt->key_desc = "name";
  312. Opt->required = YES;
  313. Opt->gisprompt = "old,grid3,3d-raster";
  314. Opt->description = _("Name of input 3D raster map");
  315. break;
  316. case G_OPT_R3_INPUTS:
  317. Opt->key = "input";
  318. Opt->type = TYPE_STRING;
  319. Opt->key_desc = "name";
  320. Opt->required = YES;
  321. Opt->multiple = YES;
  322. Opt->gisprompt = "old,grid3,3d-raster";
  323. Opt->description = _("Name of input 3D raster map(s)");
  324. break;
  325. case G_OPT_R3_OUTPUT:
  326. Opt->key = "output";
  327. Opt->type = TYPE_STRING;
  328. Opt->key_desc = "name";
  329. Opt->required = YES;
  330. Opt->gisprompt = "new,grid3,3d-raster";
  331. Opt->description = _("Name for output 3D raster map");
  332. break;
  333. case G_OPT_R3_MAP:
  334. Opt->key = "map";
  335. Opt->type = TYPE_STRING;
  336. Opt->key_desc = "name";
  337. Opt->required = YES;
  338. Opt->gisprompt = "old,grid3,3d-raster";
  339. Opt->description = _("Name of 3D raster map");
  340. break;
  341. case G_OPT_R3_MAPS:
  342. Opt->key = "map";
  343. Opt->type = TYPE_STRING;
  344. Opt->key_desc = "name";
  345. Opt->required = YES;
  346. Opt->multiple = YES;
  347. Opt->gisprompt = "old,grid3,3d-raster";
  348. Opt->description = _("Name of 3D raster map(s)");
  349. break;
  350. case G_OPT_R3_TYPE:
  351. Opt->key = "type";
  352. Opt->type = TYPE_STRING;
  353. Opt->required = NO;
  354. Opt->multiple = NO;
  355. Opt->answer = "default";
  356. Opt->options = "default,double,float";
  357. Opt->description = _("Data type used in the output raster3d map");
  358. break;
  359. case G_OPT_R3_PRECISION:
  360. Opt->key = "precision";
  361. Opt->type = TYPE_STRING;
  362. Opt->required = NO;
  363. Opt->multiple = NO;
  364. Opt->answer = "default";
  365. Opt->description =
  366. _("Number of digits used as mantissa in the internal map storage, 0 -23 for float, 0 - 52 for double, max or default");
  367. break;
  368. case G_OPT_R3_COMPRESSION:
  369. Opt->key = "compression";
  370. Opt->type = TYPE_STRING;
  371. Opt->required = NO;
  372. Opt->multiple = NO;
  373. Opt->answer = "default";
  374. Opt->options = "default,zip,none";
  375. Opt->description =
  376. _("The compression method used in the output raster3d map");
  377. break;
  378. case G_OPT_R3_TILE_DIMENSION:
  379. Opt->key = "tiledimension";
  380. Opt->type = TYPE_STRING;
  381. Opt->required = NO;
  382. Opt->multiple = NO;
  383. Opt->key_desc = "XxYxZ";
  384. Opt->answer = "default";
  385. Opt->description =
  386. _("The dimensions of the tiles used in the output raster3d map (XxYxZ or default: 16x16x8)");
  387. break;
  388. /*vector maps */
  389. case G_OPT_V_INPUT:
  390. Opt->key = "input";
  391. Opt->type = TYPE_STRING;
  392. Opt->key_desc = "name";
  393. Opt->required = YES;
  394. Opt->gisprompt = "old,vector,vector";
  395. Opt->label = _("Name of input vector map");
  396. Opt->description = _("Or data source for direct OGR access");
  397. break;
  398. case G_OPT_V_INPUTS:
  399. Opt->key = "input";
  400. Opt->type = TYPE_STRING;
  401. Opt->key_desc = "name";
  402. Opt->required = YES;
  403. Opt->multiple = YES;
  404. Opt->gisprompt = "old,vector,vector";
  405. Opt->label = _("Name of input vector map(s)");
  406. Opt->description = _("Or data source(s) for direct OGR access");
  407. break;
  408. case G_OPT_V_OUTPUT:
  409. Opt->key = "output";
  410. Opt->type = TYPE_STRING;
  411. Opt->key_desc = "name";
  412. Opt->required = YES;
  413. Opt->gisprompt = "new,vector,vector";
  414. Opt->description = _("Name for output vector map");
  415. break;
  416. case G_OPT_V_MAP:
  417. Opt->key = "map";
  418. Opt->type = TYPE_STRING;
  419. Opt->key_desc = "name";
  420. Opt->required = YES;
  421. Opt->gisprompt = "old,vector,vector";
  422. Opt->label = _("Name of vector map");
  423. Opt->description = _("Or data source for direct OGR access");
  424. break;
  425. case G_OPT_V_MAPS:
  426. Opt->key = "map";
  427. Opt->type = TYPE_STRING;
  428. Opt->key_desc = "name";
  429. Opt->required = YES;
  430. Opt->multiple = YES;
  431. Opt->gisprompt = "old,vector,vector";
  432. Opt->description = _("Name of vector map(s)");
  433. break;
  434. case G_OPT_V_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";
  440. Opt->options = "point,line,boundary,centroid,area";
  441. Opt->description = _("Input feature type");
  442. break;
  443. case G_OPT_V3_TYPE:
  444. Opt->key = "type";
  445. Opt->type = TYPE_STRING;
  446. Opt->required = NO;
  447. Opt->multiple = YES;
  448. Opt->answer = "point,line,boundary,centroid,area,face,kernel";
  449. Opt->options = "point,line,boundary,centroid,area,face,kernel";
  450. Opt->description = _("Input feature type");
  451. break;
  452. case G_OPT_V_FIELD:
  453. Opt->key = "layer";
  454. Opt->type = TYPE_STRING;
  455. Opt->required = NO;
  456. Opt->answer = "1";
  457. Opt->label = _("Layer number or name");
  458. Opt->description =
  459. _("Vector features can have category values in different layers."
  460. " This number determines which layer to use. "
  461. "When used with direct OGR access this is the layer name.");
  462. Opt->gisprompt = "old,layer,layer";
  463. break;
  464. case G_OPT_V_FIELD_ALL:
  465. Opt->key = "layer";
  466. Opt->type = TYPE_STRING;
  467. Opt->required = NO;
  468. Opt->answer = "-1";
  469. Opt->label = _("Layer number or name ('-1' for all layers)");
  470. Opt->description =
  471. _("A single vector map can be connected to multiple database "
  472. "tables. This number determines which table to use. "
  473. "When used with direct OGR access this is the layer name.");
  474. Opt->gisprompt = "old,layer_all,layer";
  475. break;
  476. case G_OPT_V_CAT:
  477. Opt->key = "cat";
  478. Opt->type = TYPE_INTEGER;
  479. Opt->required = NO;
  480. Opt->description = _("Category value");
  481. break;
  482. case G_OPT_V_CATS:
  483. Opt->key = "cats";
  484. Opt->type = TYPE_STRING;
  485. Opt->key_desc = "range";
  486. Opt->required = NO;
  487. Opt->label = _("Category values");
  488. Opt->description = _("Example: 1,3,7-9,13");
  489. break;
  490. case G_OPT_V_ID:
  491. Opt->key = "id";
  492. Opt->type = TYPE_INTEGER;
  493. Opt->required = NO;
  494. Opt->description = _("Feature id");
  495. break;
  496. case G_OPT_V_IDS:
  497. Opt->key = "ids";
  498. Opt->type = TYPE_STRING;
  499. Opt->key_desc = "range";
  500. Opt->required = NO;
  501. Opt->label = _("Feature ids");
  502. Opt->description = _("Example: 1,3,7-9,13");
  503. break;
  504. /* files */
  505. case G_OPT_F_INPUT:
  506. Opt->key = "input";
  507. Opt->type = TYPE_STRING;
  508. Opt->key_desc = "name";
  509. Opt->required = YES;
  510. Opt->gisprompt = "old,file,file";
  511. Opt->description = _("Name of input file");
  512. break;
  513. case G_OPT_F_OUTPUT:
  514. Opt->key = "output";
  515. Opt->type = TYPE_STRING;
  516. Opt->key_desc = "name";
  517. Opt->required = YES;
  518. Opt->gisprompt = "new,file,file";
  519. Opt->description = _("Name for output file");
  520. break;
  521. case G_OPT_F_SEP:
  522. Opt->key = "separator";
  523. Opt->type = TYPE_STRING;
  524. Opt->key_desc = "character";
  525. Opt->required = NO;
  526. Opt->answer = "|";
  527. Opt->label = _("Field separator");
  528. Opt->description = _("Special characters: newline, space, comma, tab");
  529. break;
  530. /* colors */
  531. case G_OPT_C_FG:
  532. Opt->key = "color";
  533. Opt->type = TYPE_STRING;
  534. Opt->key_desc = "name";
  535. Opt->required = NO;
  536. Opt->answer = DEFAULT_FG_COLOR;
  537. Opt->gisprompt = "old,color,color";
  538. Opt->label = _("Color");
  539. Opt->description = _("Either a standard color name or R:G:B triplet");
  540. break;
  541. case G_OPT_C_BG:
  542. Opt->key = "bgcolor";
  543. Opt->type = TYPE_STRING;
  544. Opt->key_desc = "name";
  545. Opt->required = NO;
  546. Opt->answer = DEFAULT_BG_COLOR;
  547. Opt->gisprompt = "old,color_none,color";
  548. Opt->label = _("Background color");
  549. Opt->description =
  550. _("Either a standard GRASS color, R:G:B triplet, or \"none\"");
  551. break;
  552. /* misc */
  553. case G_OPT_M_DIR:
  554. Opt->key = "input";
  555. Opt->type = TYPE_STRING;
  556. Opt->key_desc = "name";
  557. Opt->required = YES;
  558. Opt->gisprompt = "old,dir,dir";
  559. Opt->description = _("Name to input directory");
  560. break;
  561. case G_OPT_M_UNITS:
  562. Opt->key = "units";
  563. Opt->type = TYPE_STRING;
  564. Opt->required = NO;
  565. Opt->multiple = NO;
  566. Opt->options =
  567. "miles,feet,meters,kilometers,acres,hectares";
  568. Opt->description = _("Units");
  569. break;
  570. case G_OPT_M_DATATYPE:
  571. Opt->key = "type";
  572. Opt->key_desc = "datatype";
  573. Opt->type = TYPE_STRING;
  574. Opt->required = YES;
  575. Opt->multiple = YES;
  576. Opt->description = _("Data type(s)");
  577. break;
  578. case G_OPT_M_MAPSET:
  579. Opt->key = "mapset";
  580. Opt->type = TYPE_STRING;
  581. Opt->required = NO;
  582. Opt->multiple = NO;
  583. Opt->key_desc = "name";
  584. Opt->gisprompt = "old,mapset,mapset";
  585. Opt->label = _("Name of mapset (default: current search path)");
  586. Opt->description = _("'.' for current mapset");
  587. break;
  588. case G_OPT_M_COORDS:
  589. Opt->key = "coordinates";
  590. Opt->type = TYPE_DOUBLE;
  591. Opt->required = NO;
  592. Opt->multiple = NO;
  593. Opt->key_desc = "east,north";
  594. Opt->gisprompt = "old,coords,coords";
  595. Opt->description = _("Coordinates");
  596. break;
  597. case G_OPT_M_COLR:
  598. Opt->key = "color";
  599. Opt->key_desc = "style";
  600. Opt->type = TYPE_STRING;
  601. Opt->required = NO;
  602. Opt->options = G_color_rules_options();
  603. Opt->description = _("Name of color table");
  604. Opt->descriptions = G_color_rules_descriptions();
  605. Opt->gisprompt = "old,colortable,colortable";
  606. break;
  607. case G_OPT_M_REGION:
  608. Opt->key = "region";
  609. Opt->type = TYPE_STRING;
  610. Opt->key_desc = "name";
  611. Opt->required = NO;
  612. Opt->gisprompt = "old,windows,region";
  613. Opt->description = _("Name of saved region");
  614. break;
  615. /* Spatio-temporal modules of the temporal GIS framework */
  616. case G_OPT_STDS_INPUT:
  617. Opt->key = "input";
  618. Opt->type = TYPE_STRING;
  619. Opt->key_desc = "name";
  620. Opt->required = YES;
  621. Opt->gisprompt = "old,stds,stds";
  622. Opt->description = _("Name of the input space time dataset");
  623. break;
  624. case G_OPT_STDS_INPUTS:
  625. Opt->key = "inputs";
  626. Opt->type = TYPE_STRING;
  627. Opt->key_desc = "name";
  628. Opt->required = YES;
  629. Opt->multiple = YES;
  630. Opt->gisprompt = "old,stds,stds";
  631. Opt->description = _("Name of the input space time datasets");
  632. break;
  633. case G_OPT_STDS_OUTPUT:
  634. Opt->key = "output";
  635. Opt->type = TYPE_STRING;
  636. Opt->key_desc = "name";
  637. Opt->required = YES;
  638. Opt->gisprompt = "new,stds,stds";
  639. Opt->description = _("Name of the output space time dataset");
  640. break;
  641. case G_OPT_STRDS_INPUT:
  642. Opt->key = "input";
  643. Opt->type = TYPE_STRING;
  644. Opt->key_desc = "name";
  645. Opt->required = YES;
  646. Opt->gisprompt = "old,strds,strds";
  647. Opt->description = _("Name of the input space time raster dataset");
  648. break;
  649. case G_OPT_STRDS_INPUTS:
  650. Opt->key = "inputs";
  651. Opt->type = TYPE_STRING;
  652. Opt->key_desc = "name";
  653. Opt->required = YES;
  654. Opt->multiple = YES;
  655. Opt->gisprompt = "old,strds,strds";
  656. Opt->description = _("Name of the input space time raster datasets");
  657. break;
  658. case G_OPT_STRDS_OUTPUT:
  659. Opt->key = "output";
  660. Opt->type = TYPE_STRING;
  661. Opt->key_desc = "name";
  662. Opt->required = YES;
  663. Opt->gisprompt = "new,strds,strds";
  664. Opt->description = _("Name of the output space time raster dataset");
  665. break;
  666. case G_OPT_STVDS_INPUT:
  667. Opt->key = "input";
  668. Opt->type = TYPE_STRING;
  669. Opt->key_desc = "name";
  670. Opt->required = YES;
  671. Opt->gisprompt = "old,stvds,stvds";
  672. Opt->description = _("Name of the input space time vector dataset");
  673. break;
  674. case G_OPT_STVDS_INPUTS:
  675. Opt->key = "inputs";
  676. Opt->type = TYPE_STRING;
  677. Opt->key_desc = "name";
  678. Opt->required = YES;
  679. Opt->multiple = YES;
  680. Opt->gisprompt = "old,stvds,stvds";
  681. Opt->description = _("Name of the input space time vector datasets");
  682. break;
  683. case G_OPT_STVDS_OUTPUT:
  684. Opt->key = "output";
  685. Opt->type = TYPE_STRING;
  686. Opt->key_desc = "name";
  687. Opt->required = YES;
  688. Opt->gisprompt = "new,stvds,stvds";
  689. Opt->description = _("Name of the output space time vector dataset");
  690. break;
  691. case G_OPT_STR3DS_INPUT:
  692. Opt->key = "input";
  693. Opt->type = TYPE_STRING;
  694. Opt->key_desc = "name";
  695. Opt->required = YES;
  696. Opt->gisprompt = "old,str3ds,str3ds";
  697. Opt->description = _("Name of the input space time raster3d dataset");
  698. break;
  699. case G_OPT_STR3DS_INPUTS:
  700. Opt->key = "inputs";
  701. Opt->type = TYPE_STRING;
  702. Opt->key_desc = "name";
  703. Opt->required = YES;
  704. Opt->multiple = YES;
  705. Opt->gisprompt = "old,str3ds,str3ds";
  706. Opt->description = _("Name of the input space time raster3d datasets");
  707. break;
  708. case G_OPT_STR3DS_OUTPUT:
  709. Opt->key = "output";
  710. Opt->type = TYPE_STRING;
  711. Opt->key_desc = "name";
  712. Opt->required = YES;
  713. Opt->gisprompt = "new,str3ds,str3ds";
  714. Opt->description = _("Name of the output space time raster3d dataset");
  715. break;
  716. case G_OPT_STDS_TYPE:
  717. Opt->key = "type";
  718. Opt->type = TYPE_STRING;
  719. Opt->key_desc = "name";
  720. Opt->required = NO;
  721. Opt->answer = "strds";
  722. Opt->options = "strds,stvds,str3ds";
  723. Opt->description = _("Type of the input space time dataset");
  724. break;
  725. case G_OPT_MAP_INPUT:
  726. Opt->key = "map";
  727. Opt->type = TYPE_STRING;
  728. Opt->key_desc = "name";
  729. Opt->required = YES;
  730. Opt->gisprompt = "old,map,map";
  731. Opt->description = _("Name of the input map");
  732. break;
  733. case G_OPT_MAP_INPUTS:
  734. Opt->key = "maps";
  735. Opt->type = TYPE_STRING;
  736. Opt->key_desc = "name";
  737. Opt->required = YES;
  738. Opt->multiple = YES;
  739. Opt->gisprompt = "old,map,map";
  740. Opt->description = _("Name of the input maps");
  741. break;
  742. case G_OPT_MAP_TYPE:
  743. Opt->key = "type";
  744. Opt->type = TYPE_STRING;
  745. Opt->key_desc = "name";
  746. Opt->required = NO;
  747. Opt->answer = "rast";
  748. Opt->options = "rast,vect,rast3d";
  749. Opt->description = _("Type of the input map");
  750. break;
  751. case G_OPT_T_TYPE:
  752. Opt->key = "temporaltype";
  753. Opt->type = TYPE_STRING;
  754. Opt->key_desc = "name";
  755. Opt->required = NO;
  756. Opt->answer = "absolute";
  757. Opt->options = "absolute,relative";
  758. Opt->description = _("The temporal type of the space time dataset");
  759. break;
  760. case G_OPT_T_WHERE:
  761. Opt->key = "where";
  762. Opt->type = TYPE_STRING;
  763. Opt->key_desc = "sql_query";
  764. Opt->required = NO;
  765. Opt->label = _("WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework");
  766. Opt->description = _("Example: start_time > '2001-01-01 12:30:00'");
  767. break;
  768. case G_OPT_T_SAMPLE:
  769. Opt->key = "sampling";
  770. Opt->type = TYPE_STRING;
  771. Opt->key_desc = "name";
  772. Opt->required = NO;
  773. Opt->multiple = YES;
  774. Opt->answer = "start";
  775. Opt->options = "start,during,overlap,contain,equal,follows,precedes";
  776. Opt->description = _("The method to be used for sampling the input dataset");
  777. break;
  778. }
  779. return Opt;
  780. }
  781. /*!
  782. \brief Create standardised Flag structure.
  783. This function will create a standardised Flag structure defined by
  784. parameter <i>flag</i>. A list of valid parameters bellow. It
  785. allocates memory for the Flag structure and returns a pointer to
  786. this memory.
  787. If an invalid parameter was specified a empty Flag structure will be
  788. returned (not NULL).
  789. - G_FLG_V_TABLE (do not create attribute table)
  790. - G_FLG_V_TOPO (do not build topology)
  791. \param flag type of Flag struct to create specified by STD_FLG enum.
  792. \return pointer to an Flag struct
  793. */
  794. struct Flag *G_define_standard_flag(int flag)
  795. {
  796. struct Flag *Flg;
  797. Flg = G_define_flag();
  798. switch (flag) {
  799. case G_FLG_V_TABLE:
  800. Flg->key = 't';
  801. Flg->description = _("Do not create attribute table");
  802. break;
  803. case G_FLG_V_TOPO:
  804. Flg->key = 'b';
  805. Flg->description = _("Do not build topology");
  806. break;
  807. }
  808. return Flg;
  809. }