parser_standard_options.c 26 KB

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