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