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