parser_standard_options.c 26 KB

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