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