parser_standard_options.c 25 KB

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