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