GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
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 
113  - temporal GIS framework
114  - G_OPT_STDS_INPUT
115  - G_OPT_STDS_INPUTS
116  - G_OPT_STDS_OUTPUT
117  - G_OPT_STRDS_INPUT
118  - G_OPT_STRDS_INPUTS
119  - G_OPT_STRDS_OUTPUT
120  - G_OPT_STRDS_OUTPUTS
121  - G_OPT_STR3DS_INPUT
122  - G_OPT_STR3DS_INPUTS
123  - G_OPT_STR3DS_OUTPUT
124  - G_OPT_STVDS_INPUT
125  - G_OPT_STVDS_INPUTS
126  - G_OPT_STVDS_OUTPUT
127  - G_OPT_MAP_INPUT
128  - G_OPT_MAP_INPUTS
129  - G_OPT_STDS_TYPE
130  - G_OPT_MAP_TYPE
131  - G_OPT_T_TYPE
132  - G_OPT_T_WHERE
133 
134  \param opt type of Option struct to create specified by STD_OPT enum
135 
136  \return pointer to an Option struct
137 */
139 {
140  struct Option *Opt;
141  char *memstr;
142 
143  Opt = G_define_option();
144 
145  switch (opt) {
146  case G_OPT_DB_SQL:
147  Opt->key = "sql";
148  Opt->type = TYPE_STRING;
149  Opt->key_desc = "sql_query";
150  Opt->required = NO;
151  Opt->label = _("SQL SELECT statement");
152  Opt->description =
153  _("Example: select * from towns where population > 10000");
154  break;
155  case G_OPT_DB_WHERE:
156  Opt->key = "where";
157  Opt->type = TYPE_STRING;
158  Opt->gisprompt = "old,sql_query,sql_query";
159  Opt->key_desc = "sql_query";
160  Opt->required = NO;
161  Opt->label = _("WHERE conditions of SQL statement without 'where' keyword");
162  Opt->description = _("Example: income < 1000 and population >= 10000");
163  break;
164  case G_OPT_DB_TABLE:
165  Opt->key = "table";
166  Opt->type = TYPE_STRING;
167  Opt->key_desc = "name";
168  Opt->required = NO;
169  Opt->multiple = NO;
170  Opt->description = _("Name of attribute table");
171  Opt->gisprompt = "old,dbtable,dbtable";
172  break;
173  case G_OPT_DB_DRIVER:
174  Opt->key = "driver";
175  Opt->type = TYPE_STRING;
176  Opt->key_desc = "name";
177  Opt->required = NO;
178  Opt->multiple = NO;
179  Opt->description = _("Name of database driver");
180  Opt->gisprompt = "old,dbdriver,dbdriver";
181  break;
182  case G_OPT_DB_DATABASE:
183  Opt->key = "database";
184  Opt->type = TYPE_STRING;
185  Opt->key_desc = "name";
186  Opt->required = NO;
187  Opt->multiple = NO;
188  Opt->description = _("Name of database");
189  Opt->gisprompt = "old,dbname,dbname";
190  break;
191  case G_OPT_DB_SCHEMA:
192  Opt->key = "schema";
193  Opt->type = TYPE_STRING;
194  Opt->key_desc = "name";
195  Opt->required = NO;
196  Opt->multiple = NO;
197  Opt->label = _("Database schema");
198  Opt->description = _("Do not use this option if schemas "
199  "are not supported by driver/database server");
200  break;
201  case G_OPT_DB_COLUMN:
202  Opt->key = "column";
203  Opt->type = TYPE_STRING;
204  Opt->key_desc = "name";
205  Opt->required = NO;
206  Opt->multiple = NO;
207  Opt->description = _("Name of attribute column");
208  Opt->gisprompt = "old,dbcolumn,dbcolumn";
209  break;
210  case G_OPT_DB_COLUMNS:
211  Opt->key = "columns";
212  Opt->type = TYPE_STRING;
213  Opt->key_desc = "name";
214  Opt->required = NO;
215  Opt->multiple = YES;
216  Opt->description = _("Name of attribute column(s)");
217  Opt->gisprompt = "old,dbcolumn,dbcolumn";
218  break;
219  case G_OPT_DB_KEYCOLUMN:
220  Opt->key = "key";
221  Opt->type = TYPE_STRING;
222  Opt->key_desc = "name";
223  Opt->required = NO;
224  Opt->multiple = NO;
225  Opt->label = _("Name of key column");
226  Opt->description = _("Must refer to an integer column");
227  /* Opt->gisprompt = "old,dbcolumn,dbcolumn"; */
228  Opt->answer = GV_KEY_COLUMN;
229  break;
230 
231  /* imagery group */
232  case G_OPT_I_GROUP:
233  Opt->key = "group";
234  Opt->type = TYPE_STRING;
235  Opt->key_desc = "name";
236  Opt->required = YES;
237  Opt->gisprompt = "old,group,group";
238  Opt->description = _("Name of input imagery group");
239  break;
240  case G_OPT_I_SUBGROUP:
241  Opt->key = "subgroup";
242  Opt->type = TYPE_STRING;
243  Opt->key_desc = "name";
244  Opt->required = YES;
245  Opt->gisprompt = "old,subgroup,subgroup";
246  Opt->description = _("Name of input imagery subgroup");
247  break;
248 
249  /* raster maps */
250  case G_OPT_MEMORYMB:
251  Opt->key = "memory";
252  Opt->type = TYPE_INTEGER;
253  Opt->key_desc = "memory in MB";
254  Opt->required = NO;
255  Opt->multiple = NO;
256  Opt->answer = "300";
257  /* start dynamic answer */
258  /* check MEMORYMB in GISRC, set with g.gisenv */
259  memstr = G_store(G_getenv_nofatal("MEMORYMB"));
260  if (memstr && *memstr)
261  Opt->answer = memstr;
262  /* end dynamic answer */
263  Opt->label = _("Maximum memory to be used (in MB)");
264  Opt->description = _("Cache size for raster rows");
265  break;
266  case G_OPT_R_INPUT:
267  Opt->key = "input";
268  Opt->type = TYPE_STRING;
269  Opt->key_desc = "name";
270  Opt->required = YES;
271  Opt->gisprompt = "old,cell,raster";
272  Opt->description = _("Name of input raster map");
273  break;
274  case G_OPT_R_INPUTS:
275  Opt->key = "input";
276  Opt->type = TYPE_STRING;
277  Opt->key_desc = "name";
278  Opt->required = YES;
279  Opt->multiple = YES;
280  Opt->gisprompt = "old,cell,raster";
281  Opt->description = _("Name of input raster map(s)");
282  break;
283  case G_OPT_R_OUTPUT:
284  Opt->key = "output";
285  Opt->type = TYPE_STRING;
286  Opt->key_desc = "name";
287  Opt->required = YES;
288  Opt->gisprompt = "new,cell,raster";
289  Opt->description = _("Name for output raster map");
290  break;
291  case G_OPT_R_OUTPUTS:
292  Opt->key = "output";
293  Opt->type = TYPE_STRING;
294  Opt->key_desc = "name";
295  Opt->required = YES;
296  Opt->multiple = YES;
297  Opt->gisprompt = "new,cell,raster";
298  Opt->description = _("Name for output raster map(s)");
299  break;
300  case G_OPT_R_MAP:
301  Opt->key = "map";
302  Opt->type = TYPE_STRING;
303  Opt->key_desc = "name";
304  Opt->required = YES;
305  Opt->gisprompt = "old,cell,raster";
306  Opt->description = _("Name of raster map");
307  break;
308  case G_OPT_R_MAPS:
309  Opt->key = "map";
310  Opt->type = TYPE_STRING;
311  Opt->key_desc = "name";
312  Opt->required = YES;
313  Opt->multiple = YES;
314  Opt->gisprompt = "old,cell,raster";
315  Opt->description = _("Name of raster map(s)");
316  break;
317  case G_OPT_R_BASE:
318  Opt->key = "base";
319  Opt->type = TYPE_STRING;
320  Opt->key_desc = "name";
321  Opt->required = YES;
322  Opt->gisprompt = "old,cell,raster";
323  Opt->description = _("Name of base raster map");
324  break;
325  case G_OPT_R_COVER:
326  Opt->key = "cover";
327  Opt->type = TYPE_STRING;
328  Opt->key_desc = "name";
329  Opt->required = YES;
330  Opt->gisprompt = "old,cell,raster";
331  Opt->description = _("Name of cover raster map");
332  break;
333  case G_OPT_R_ELEV:
334  Opt->key = "elevation";
335  Opt->type = TYPE_STRING;
336  Opt->key_desc = "name";
337  Opt->required = YES;
338  Opt->gisprompt = "old,cell,raster";
339  Opt->description = _("Name of input elevation raster map");
340  break;
341  case G_OPT_R_ELEVS:
342  Opt->key = "elevation";
343  Opt->type = TYPE_STRING;
344  Opt->key_desc = "name";
345  Opt->required = YES;
346  Opt->multiple = YES;
347  Opt->gisprompt = "old,cell,raster";
348  Opt->description = _("Name of input elevation raster map(s)");
349  break;
350  case G_OPT_R_TYPE:
351  Opt->key = "type";
352  Opt->type = TYPE_STRING;
353  Opt->required = YES;
354  Opt->multiple = NO;
355  Opt->label = _("Type of raster map to be created");
356  Opt->description = _("Storage type for resultant raster map");
357  Opt->options = "CELL,FCELL,DCELL";
358  G_asprintf((char **) &(Opt->descriptions),
359  "CELL;%s;FCELL;%s;DCELL;%s",
360  _("Integer"),
361  _("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"),
374  _("Bicubic interpolation"));
375  break;
377  Opt->key = "input";
378  Opt->type = TYPE_STRING;
379  Opt->key_desc = "basename";
380  Opt->required = YES;
381  Opt->multiple = NO;
382  Opt->gisprompt = "old,cell,raster";
383  Opt->description = _("Name of input basename raster map(s)");
384  break;
386  Opt->key = "output";
387  Opt->type = TYPE_STRING;
388  Opt->key_desc = "basename";
389  Opt->required = YES;
390  Opt->multiple = NO;
391  Opt->gisprompt = "new,cell,raster";
392  Opt->description = _("Name for output basename raster map(s)");
393  break;
394 
395  /*g3d maps */
396  case G_OPT_R3_INPUT:
397  Opt->key = "input";
398  Opt->type = TYPE_STRING;
399  Opt->key_desc = "name";
400  Opt->required = YES;
401  Opt->gisprompt = "old,grid3,raster_3d";
402  Opt->description = _("Name of input 3D raster map");
403  break;
404  case G_OPT_R3_INPUTS:
405  Opt->key = "input";
406  Opt->type = TYPE_STRING;
407  Opt->key_desc = "name";
408  Opt->required = YES;
409  Opt->multiple = YES;
410  Opt->gisprompt = "old,grid3,raster_3d";
411  Opt->description = _("Name of input 3D raster map(s)");
412  break;
413  case G_OPT_R3_OUTPUT:
414  Opt->key = "output";
415  Opt->type = TYPE_STRING;
416  Opt->key_desc = "name";
417  Opt->required = YES;
418  Opt->gisprompt = "new,grid3,raster_3d";
419  Opt->description = _("Name for output 3D raster map");
420  break;
421  case G_OPT_R3_MAP:
422  Opt->key = "map";
423  Opt->type = TYPE_STRING;
424  Opt->key_desc = "name";
425  Opt->required = YES;
426  Opt->gisprompt = "old,grid3,raster_3d";
427  Opt->description = _("Name of 3D raster map");
428  break;
429  case G_OPT_R3_MAPS:
430  Opt->key = "map";
431  Opt->type = TYPE_STRING;
432  Opt->key_desc = "name";
433  Opt->required = YES;
434  Opt->multiple = YES;
435  Opt->gisprompt = "old,grid3,raster_3d";
436  Opt->description = _("Name of 3D raster map(s)");
437  break;
438  case G_OPT_R3_TYPE:
439  Opt->key = "type";
440  Opt->type = TYPE_STRING;
441  Opt->required = NO;
442  Opt->multiple = NO;
443  Opt->answer = "default";
444  Opt->options = "default,double,float";
445  Opt->description = _("Data type used in the output raster3d map");
446  break;
447  case G_OPT_R3_PRECISION:
448  Opt->key = "precision";
449  Opt->type = TYPE_STRING;
450  Opt->required = NO;
451  Opt->multiple = NO;
452  Opt->answer = "default";
453  Opt->description =
454  _("Number of digits used as mantissa in the internal map storage, 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 =
474  _("The dimensions of the tiles used in the output 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 = _("Special characters: pipe, comma, space, tab, newline");
630  break;
631 
632  /* colors */
633  case G_OPT_C:
634  Opt->key = "color";
635  Opt->type = TYPE_STRING;
636  Opt->key_desc = "name";
637  Opt->required = NO;
638  Opt->answer = DEFAULT_FG_COLOR;
639  Opt->gisprompt = "old,color,color";
640  Opt->label = _("Color");
641  Opt->description =
642  _("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 =
673  "miles,feet,meters,kilometers,acres,hectares";
674  Opt->description = _("Units");
675  break;
676 
677  case G_OPT_M_DATATYPE:
678  Opt->key = "type";
679  Opt->key_desc = "datatype";
680  Opt->type = TYPE_STRING;
681  Opt->required = YES;
682  Opt->multiple = YES;
683  Opt->description = _("Data type(s)");
684  break;
685 
686  case G_OPT_M_MAPSET:
687  Opt->key = "mapset";
688  Opt->type = TYPE_STRING;
689  Opt->required = NO;
690  Opt->multiple = NO;
691  Opt->key_desc = "name";
692  Opt->gisprompt = "old,mapset,mapset";
693  Opt->label = _("Name of mapset (default: current search path)");
694  Opt->description = _("'.' for current mapset");
695  break;
696 
697  case G_OPT_M_LOCATION:
698  Opt->key = "location";
699  Opt->type = TYPE_STRING;
700  Opt->required = NO;
701  Opt->multiple = NO;
702  Opt->label = _("Location name");
703  Opt->description = _("Location name (not location path)");
704  Opt->gisprompt = "old,location,location";
705  Opt->key_desc = "name";
706  break;
707 
708  case G_OPT_M_DBASE:
709  Opt->key = "dbase";
710  Opt->type = TYPE_STRING;
711  Opt->required = NO;
712  Opt->multiple = NO;
713  Opt->label = _("GRASS GIS database directory");
714  Opt->description = _("Default: path to the current GRASS GIS database");
715  Opt->gisprompt = "old,dbase,dbase";
716  Opt->key_desc = "path";
717  break;
718 
719  case G_OPT_M_COORDS:
720  Opt->key = "coordinates";
721  Opt->type = TYPE_DOUBLE;
722  Opt->required = NO;
723  Opt->multiple = NO;
724  Opt->key_desc = "east,north";
725  Opt->gisprompt = "old,coords,coords";
726  Opt->description = _("Coordinates");
727  break;
728 
729  case G_OPT_M_COLR:
730  Opt->key = "color";
731  Opt->key_desc = "style";
732  Opt->type = TYPE_STRING;
733  Opt->required = NO;
735  Opt->description = _("Name of color table");
737  Opt->gisprompt = "old,colortable,colortable";
738  break;
739 
740  case G_OPT_M_NULL_VALUE:
741  Opt->key = "null_value";
742  Opt->key_desc = "string";
743  Opt->type = TYPE_STRING;
744  Opt->required = NO;
745  Opt->multiple = NO;
746  Opt->description = _("String representing NULL value");
747  break;
748 
749  case G_OPT_M_REGION:
750  Opt->key = "region";
751  Opt->type = TYPE_STRING;
752  Opt->key_desc = "name";
753  Opt->required = NO;
754  Opt->gisprompt = "old,windows,region";
755  Opt->description = _("Name of saved region");
756  break;
757 
758  /* Spatio-temporal modules of the temporal GIS framework */
759  case G_OPT_STDS_INPUT:
760  Opt->key = "input";
761  Opt->type = TYPE_STRING;
762  Opt->key_desc = "name";
763  Opt->required = YES;
764  Opt->gisprompt = "old,stds,stds";
765  Opt->description = _("Name of the input space time dataset");
766  break;
767  case G_OPT_STDS_INPUTS:
768  Opt->key = "inputs";
769  Opt->type = TYPE_STRING;
770  Opt->key_desc = "name";
771  Opt->required = YES;
772  Opt->multiple = YES;
773  Opt->gisprompt = "old,stds,stds";
774  Opt->description = _("Name of the input space time datasets");
775  break;
776  case G_OPT_STDS_OUTPUT:
777  Opt->key = "output";
778  Opt->type = TYPE_STRING;
779  Opt->key_desc = "name";
780  Opt->required = YES;
781  Opt->gisprompt = "new,stds,stds";
782  Opt->description = _("Name of the output space time dataset");
783  break;
784  case G_OPT_STRDS_INPUT:
785  Opt->key = "input";
786  Opt->type = TYPE_STRING;
787  Opt->key_desc = "name";
788  Opt->required = YES;
789  Opt->gisprompt = "old,strds,strds";
790  Opt->description = _("Name of the input space time raster dataset");
791  break;
792  case G_OPT_STRDS_INPUTS:
793  Opt->key = "inputs";
794  Opt->type = TYPE_STRING;
795  Opt->key_desc = "name";
796  Opt->required = YES;
797  Opt->multiple = YES;
798  Opt->gisprompt = "old,strds,strds";
799  Opt->description = _("Name of the input space time raster datasets");
800  break;
801  case G_OPT_STRDS_OUTPUT:
802  Opt->key = "output";
803  Opt->type = TYPE_STRING;
804  Opt->key_desc = "name";
805  Opt->required = YES;
806  Opt->gisprompt = "new,strds,strds";
807  Opt->description = _("Name of the output space time raster dataset");
808  break;
809  case G_OPT_STRDS_OUTPUTS:
810  Opt->key = "outputs";
811  Opt->type = TYPE_STRING;
812  Opt->key_desc = "name";
813  Opt->required = YES;
814  Opt->multiple = YES;
815  Opt->gisprompt = "new,strds,strds";
816  Opt->description = _("Name of the output space time raster datasets");
817  break;
818  case G_OPT_STVDS_INPUT:
819  Opt->key = "input";
820  Opt->type = TYPE_STRING;
821  Opt->key_desc = "name";
822  Opt->required = YES;
823  Opt->gisprompt = "old,stvds,stvds";
824  Opt->description = _("Name of the input space time vector dataset");
825  break;
826  case G_OPT_STVDS_INPUTS:
827  Opt->key = "inputs";
828  Opt->type = TYPE_STRING;
829  Opt->key_desc = "name";
830  Opt->required = YES;
831  Opt->multiple = YES;
832  Opt->gisprompt = "old,stvds,stvds";
833  Opt->description = _("Name of the input space time vector datasets");
834  break;
835  case G_OPT_STVDS_OUTPUT:
836  Opt->key = "output";
837  Opt->type = TYPE_STRING;
838  Opt->key_desc = "name";
839  Opt->required = YES;
840  Opt->gisprompt = "new,stvds,stvds";
841  Opt->description = _("Name of the output space time vector dataset");
842  break;
843  case G_OPT_STR3DS_INPUT:
844  Opt->key = "input";
845  Opt->type = TYPE_STRING;
846  Opt->key_desc = "name";
847  Opt->required = YES;
848  Opt->gisprompt = "old,str3ds,str3ds";
849  Opt->description = _("Name of the input space time raster3d dataset");
850  break;
851  case G_OPT_STR3DS_INPUTS:
852  Opt->key = "inputs";
853  Opt->type = TYPE_STRING;
854  Opt->key_desc = "name";
855  Opt->required = YES;
856  Opt->multiple = YES;
857  Opt->gisprompt = "old,str3ds,str3ds";
858  Opt->description = _("Name of the input space time raster3d datasets");
859  break;
860  case G_OPT_STR3DS_OUTPUT:
861  Opt->key = "output";
862  Opt->type = TYPE_STRING;
863  Opt->key_desc = "name";
864  Opt->required = YES;
865  Opt->gisprompt = "new,str3ds,str3ds";
866  Opt->description = _("Name of the output space time raster3d dataset");
867  break;
868  case G_OPT_STDS_TYPE:
869  Opt->key = "type";
870  Opt->type = TYPE_STRING;
871  Opt->key_desc = "name";
872  Opt->required = NO;
873  Opt->answer = "strds";
874  Opt->options = "strds,stvds,str3ds";
875  Opt->description = _("Type of the input space time dataset");
876  break;
877  case G_OPT_MAP_INPUT:
878  Opt->key = "map";
879  Opt->type = TYPE_STRING;
880  Opt->key_desc = "name";
881  Opt->required = YES;
882  Opt->gisprompt = "old,map,map";
883  Opt->description = _("Name of the input map");
884  break;
885  case G_OPT_MAP_INPUTS:
886  Opt->key = "maps";
887  Opt->type = TYPE_STRING;
888  Opt->key_desc = "name";
889  Opt->required = YES;
890  Opt->multiple = YES;
891  Opt->gisprompt = "old,map,map";
892  Opt->description = _("Name of the input maps");
893  break;
894  case G_OPT_MAP_TYPE:
895  Opt->key = "type";
896  Opt->type = TYPE_STRING;
897  Opt->key_desc = "name";
898  Opt->required = NO;
899  Opt->answer = "raster";
900  Opt->options = "raster,vector,raster_3d";
901  Opt->description = _("Type of the input map");
902  break;
903  case G_OPT_T_TYPE:
904  Opt->key = "temporaltype";
905  Opt->type = TYPE_STRING;
906  Opt->key_desc = "name";
907  Opt->required = NO;
908  Opt->answer = "absolute";
909  Opt->options = "absolute,relative";
910  Opt->description = _("The temporal type of the space time dataset");
911  break;
912  case G_OPT_T_WHERE:
913  Opt->key = "where";
914  Opt->type = TYPE_STRING;
915  Opt->key_desc = "sql_query";
916  Opt->required = NO;
917  Opt->label = _("WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework");
918  Opt->description = _("Example: start_time > '2001-01-01 12:30:00'");
919  break;
920  case G_OPT_T_SAMPLE:
921  Opt->key = "sampling";
922  Opt->type = TYPE_STRING;
923  Opt->key_desc = "name";
924  Opt->required = NO;
925  Opt->multiple = YES;
926  Opt->answer = "start";
927  Opt->options = "start,during,overlap,contain,equal,follows,precedes";
928  Opt->description = _("The method to be used for sampling the input dataset");
929  break;
930  }
931 
932  return Opt;
933 }
934 
935 /*!
936  \brief Create standardised Flag structure.
937 
938  This function will create a standardised Flag structure defined by
939  parameter <i>flag</i>. A list of valid parameters below. It
940  allocates memory for the Flag structure and returns a pointer to
941  this memory.
942 
943  If an invalid parameter was specified a empty Flag structure will be
944  returned (not NULL).
945 
946  - G_FLG_V_TABLE (do not create attribute table)
947  - G_FLG_V_TOPO (do not build topology)
948 
949  \param flag type of Flag struct to create specified by STD_FLG enum.
950 
951  \return pointer to an Flag struct
952 */
953 struct Flag *G_define_standard_flag(int flag)
954 {
955  struct Flag *Flg;
956 
957  Flg = G_define_flag();
958 
959  switch (flag) {
960  case G_FLG_V_TABLE:
961  Flg->key = 't';
962  Flg->description = _("Do not create attribute table");
963  break;
964  case G_FLG_V_TOPO:
965  Flg->key = 'b';
966  Flg->label = _("Do not build topology");
967  Flg->description = _("Advantageous when handling a large number of points");
968  break;
969  }
970 
971  return Flg;
972 }
#define GV_KEY_COLUMN
Name of default key column.
Definition: gis.h:388
#define NO
Definition: gis.h:164
#define TYPE_DOUBLE
Definition: gis.h:161
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:542
#define TYPE_STRING
Definition: gis.h:162
#define DEFAULT_FG_COLOR
Definition: gis.h:370
struct Flag * G_define_standard_flag(int flag)
Create standardised Flag structure.
Definition: gis.h:296
const char * description
Definition: gis.h:541
#define TYPE_INTEGER
Definition: gis.h:160
int type
Definition: gis.h:534
char * answer
Definition: gis.h:544
struct Option * G_define_option(void)
Initializes an Option struct.
Definition: parser.c:210
int multiple
Definition: gis.h:536
Structure that stores flag info.
Definition: gis.h:560
char key
Definition: gis.h:562
int required
Definition: gis.h:535
const char * label
Definition: gis.h:566
const char * label
Definition: gis.h:540
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:531
#define _(str)
Definition: glocale.h:10
const char * description
Definition: gis.h:567
const char * G_getenv_nofatal(const char *)
Get environment variable.
Definition: env.c:383
char * G_store(const char *)
Copy string to allocated memory.
Definition: strings.c:87
Definition: gis.h:295
const char * key
Definition: gis.h:533
const char * gisprompt
Definition: gis.h:548
int G_asprintf(char **, const char *,...) __attribute__((format(printf
const char * options
Definition: gis.h:537
const char * key_desc
Definition: gis.h:539
#define YES
Definition: gis.h:163