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