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