16 #include <grass/gis.h>
17 #include <grass/glocale.h>
19 #include "parser_local_proto.h"
151 Opt->type = TYPE_STRING;
152 Opt->key_desc =
"sql_query";
154 Opt->label = _(
"SQL SELECT statement");
156 _(
"Example: select * from towns where population > 10000");
160 Opt->type = TYPE_STRING;
161 Opt->gisprompt =
"old,sql_query,sql_query";
162 Opt->key_desc =
"sql_query";
165 _(
"WHERE conditions of SQL statement without 'where' keyword");
166 Opt->description = _(
"Example: income < 1000 and population >= 10000");
170 Opt->type = TYPE_STRING;
171 Opt->key_desc =
"name";
174 Opt->description = _(
"Name of attribute table");
175 Opt->gisprompt =
"old,dbtable,dbtable";
177 case G_OPT_DB_DRIVER:
179 Opt->type = TYPE_STRING;
180 Opt->key_desc =
"name";
183 Opt->description = _(
"Name of database driver");
184 Opt->gisprompt =
"old,dbdriver,dbdriver";
186 case G_OPT_DB_DATABASE:
187 Opt->key =
"database";
188 Opt->type = TYPE_STRING;
189 Opt->key_desc =
"name";
192 Opt->description = _(
"Name of database");
193 Opt->gisprompt =
"old,dbname,dbname";
195 case G_OPT_DB_SCHEMA:
197 Opt->type = TYPE_STRING;
198 Opt->key_desc =
"name";
201 Opt->label = _(
"Database schema");
202 Opt->description = _(
"Do not use this option if schemas "
203 "are not supported by driver/database server");
205 case G_OPT_DB_COLUMN:
207 Opt->type = TYPE_STRING;
208 Opt->key_desc =
"name";
211 Opt->description = _(
"Name of attribute column");
212 Opt->gisprompt =
"old,dbcolumn,dbcolumn";
214 case G_OPT_DB_COLUMNS:
215 Opt->key =
"columns";
216 Opt->type = TYPE_STRING;
217 Opt->key_desc =
"name";
220 Opt->description = _(
"Name of attribute column(s)");
221 Opt->gisprompt =
"old,dbcolumn,dbcolumn";
223 case G_OPT_DB_KEYCOLUMN:
225 Opt->type = TYPE_STRING;
226 Opt->key_desc =
"name";
229 Opt->label = _(
"Name of key column");
230 Opt->description = _(
"Must refer to an integer column");
232 Opt->answer = GV_KEY_COLUMN;
238 Opt->type = TYPE_STRING;
239 Opt->key_desc =
"name";
241 Opt->gisprompt =
"old,group,group";
242 Opt->description = _(
"Name of input imagery group");
244 case G_OPT_I_SUBGROUP:
245 Opt->key =
"subgroup";
246 Opt->type = TYPE_STRING;
247 Opt->key_desc =
"name";
249 Opt->gisprompt =
"old,subgroup,subgroup";
250 Opt->description = _(
"Name of input imagery subgroup");
256 Opt->type = TYPE_INTEGER;
257 Opt->key_desc =
"memory in MB";
264 if (memstr && *memstr)
265 Opt->answer = memstr;
267 Opt->label = _(
"Maximum memory to be used (in MB)");
268 Opt->description = _(
"Cache size for raster rows");
272 Opt->type = TYPE_STRING;
273 Opt->key_desc =
"name";
275 Opt->gisprompt =
"old,cell,raster";
276 Opt->description = _(
"Name of input raster map");
280 Opt->type = TYPE_STRING;
281 Opt->key_desc =
"name";
284 Opt->gisprompt =
"old,cell,raster";
285 Opt->description = _(
"Name of input raster map(s)");
289 Opt->type = TYPE_STRING;
290 Opt->key_desc =
"name";
292 Opt->gisprompt =
"new,cell,raster";
293 Opt->description = _(
"Name for output raster map");
295 case G_OPT_R_OUTPUTS:
297 Opt->type = TYPE_STRING;
298 Opt->key_desc =
"name";
301 Opt->gisprompt =
"new,cell,raster";
302 Opt->description = _(
"Name for output raster map(s)");
306 Opt->type = TYPE_STRING;
307 Opt->key_desc =
"name";
309 Opt->gisprompt =
"old,cell,raster";
310 Opt->description = _(
"Name of raster map");
314 Opt->type = TYPE_STRING;
315 Opt->key_desc =
"name";
318 Opt->gisprompt =
"old,cell,raster";
319 Opt->description = _(
"Name of raster map(s)");
323 Opt->type = TYPE_STRING;
324 Opt->key_desc =
"name";
326 Opt->gisprompt =
"old,cell,raster";
327 Opt->description = _(
"Name of base raster map");
331 Opt->type = TYPE_STRING;
332 Opt->key_desc =
"name";
334 Opt->gisprompt =
"old,cell,raster";
335 Opt->description = _(
"Name of cover raster map");
338 Opt->key =
"elevation";
339 Opt->type = TYPE_STRING;
340 Opt->key_desc =
"name";
342 Opt->gisprompt =
"old,cell,raster";
343 Opt->description = _(
"Name of input elevation raster map");
346 Opt->key =
"elevation";
347 Opt->type = TYPE_STRING;
348 Opt->key_desc =
"name";
351 Opt->gisprompt =
"old,cell,raster";
352 Opt->description = _(
"Name of input elevation raster map(s)");
356 Opt->type = TYPE_STRING;
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"));
366 case G_OPT_R_INTERP_TYPE:
368 Opt->type = TYPE_STRING;
370 Opt->description = _(
"Sampling interpolation method");
371 Opt->options =
"nearest,bilinear,bicubic";
373 "nearest;%s;bilinear;%s;bicubic;%s",
374 _(
"Nearest-neighbor interpolation"),
375 _(
"Bilinear interpolation"), _(
"Bicubic interpolation"));
377 case G_OPT_R_BASENAME_INPUT:
379 Opt->type = TYPE_STRING;
380 Opt->key_desc =
"basename";
383 Opt->gisprompt =
"old,cell,raster";
384 Opt->description = _(
"Name of input basename raster map(s)");
386 case G_OPT_R_BASENAME_OUTPUT:
388 Opt->type = TYPE_STRING;
389 Opt->key_desc =
"basename";
392 Opt->gisprompt =
"new,cell,raster";
393 Opt->description = _(
"Name for output basename raster map(s)");
399 Opt->type = TYPE_STRING;
400 Opt->key_desc =
"name";
402 Opt->gisprompt =
"old,grid3,raster_3d";
403 Opt->description = _(
"Name of input 3D raster map");
405 case G_OPT_R3_INPUTS:
407 Opt->type = TYPE_STRING;
408 Opt->key_desc =
"name";
411 Opt->gisprompt =
"old,grid3,raster_3d";
412 Opt->description = _(
"Name of input 3D raster map(s)");
414 case G_OPT_R3_OUTPUT:
416 Opt->type = TYPE_STRING;
417 Opt->key_desc =
"name";
419 Opt->gisprompt =
"new,grid3,raster_3d";
420 Opt->description = _(
"Name for output 3D raster map");
424 Opt->type = TYPE_STRING;
425 Opt->key_desc =
"name";
427 Opt->gisprompt =
"old,grid3,raster_3d";
428 Opt->description = _(
"Name of 3D raster map");
432 Opt->type = TYPE_STRING;
433 Opt->key_desc =
"name";
436 Opt->gisprompt =
"old,grid3,raster_3d";
437 Opt->description = _(
"Name of 3D raster map(s)");
441 Opt->type = TYPE_STRING;
444 Opt->answer =
"default";
445 Opt->options =
"default,double,float";
446 Opt->description = _(
"Data type used in the output raster3d map");
448 case G_OPT_R3_PRECISION:
449 Opt->key =
"precision";
450 Opt->type = TYPE_STRING;
453 Opt->answer =
"default";
455 _(
"Number of digits used as mantissa in the internal map storage, "
456 "0 -23 for float, 0 - 52 for double, max or default");
458 case G_OPT_R3_COMPRESSION:
459 Opt->key =
"compression";
460 Opt->type = TYPE_STRING;
463 Opt->answer =
"default";
464 Opt->options =
"default,zip,none";
466 _(
"The compression method used in the output raster3d map");
468 case G_OPT_R3_TILE_DIMENSION:
469 Opt->key =
"tiledimension";
470 Opt->type = TYPE_STRING;
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)");
482 Opt->type = TYPE_STRING;
483 Opt->key_desc =
"name";
485 Opt->gisprompt =
"old,vector,vector";
486 Opt->label = _(
"Name of input vector map");
487 Opt->description = _(
"Or data source for direct OGR access");
491 Opt->type = TYPE_STRING;
492 Opt->key_desc =
"name";
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");
501 Opt->type = TYPE_STRING;
502 Opt->key_desc =
"name";
504 Opt->gisprompt =
"new,vector,vector";
505 Opt->description = _(
"Name for output vector map");
509 Opt->type = TYPE_STRING;
510 Opt->key_desc =
"name";
512 Opt->gisprompt =
"old,vector,vector";
513 Opt->label = _(
"Name of vector map");
514 Opt->description = _(
"Or data source for direct OGR access");
518 Opt->type = TYPE_STRING;
519 Opt->key_desc =
"name";
522 Opt->gisprompt =
"old,vector,vector";
523 Opt->description = _(
"Name of vector map(s)");
527 Opt->type = TYPE_STRING;
530 Opt->answer =
"point,line,boundary,centroid,area";
531 Opt->options =
"point,line,boundary,centroid,area";
532 Opt->description = _(
"Input feature type");
536 Opt->type = TYPE_STRING;
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");
545 Opt->type = TYPE_STRING;
548 Opt->label = _(
"Layer number or name");
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";
555 case G_OPT_V_FIELD_ALL:
557 Opt->type = TYPE_STRING;
560 Opt->label = _(
"Layer number or name ('-1' for all layers)");
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";
569 Opt->type = TYPE_INTEGER;
571 Opt->description = _(
"Category value");
572 Opt->gisprompt =
"old,cat,cats";
576 Opt->type = TYPE_STRING;
577 Opt->key_desc =
"range";
579 Opt->label = _(
"Category values");
580 Opt->description = _(
"Example: 1,3,7-9,13");
581 Opt->gisprompt =
"old,cats,cats";
585 Opt->type = TYPE_INTEGER;
587 Opt->description = _(
"Feature id");
591 Opt->type = TYPE_STRING;
592 Opt->key_desc =
"range";
594 Opt->label = _(
"Feature ids");
595 Opt->description = _(
"Example: 1,3,7-9,13");
601 Opt->type = TYPE_STRING;
602 Opt->key_desc =
"name";
604 Opt->gisprompt =
"old,file,file";
605 Opt->description = _(
"Name of input file");
607 case G_OPT_F_BIN_INPUT:
609 Opt->type = TYPE_STRING;
610 Opt->key_desc =
"name";
612 Opt->gisprompt =
"old,bin,file";
613 Opt->description = _(
"Name of input file");
617 Opt->type = TYPE_STRING;
618 Opt->key_desc =
"name";
620 Opt->gisprompt =
"new,file,file";
621 Opt->description = _(
"Name for output file");
624 Opt->key =
"separator";
625 Opt->type = TYPE_STRING;
626 Opt->key_desc =
"character";
628 Opt->gisprompt =
"old,separator,separator";
629 Opt->answer =
"pipe";
630 Opt->label = _(
"Field separator");
632 _(
"Special characters: pipe, comma, space, tab, newline");
638 Opt->type = TYPE_STRING;
639 Opt->key_desc =
"name";
641 Opt->answer = DEFAULT_FG_COLOR;
642 Opt->gisprompt =
"old,color,color";
643 Opt->label = _(
"Color");
644 Opt->description = _(
"Either a standard color name or R:G:B triplet");
648 Opt->type = TYPE_STRING;
649 Opt->key_desc =
"name";
651 Opt->answer = DEFAULT_FG_COLOR;
652 Opt->gisprompt =
"old,color_none,color";
653 Opt->label = _(
"Color");
655 _(
"Either a standard color name, R:G:B triplet, or \"none\"");
658 Opt->key =
"color_format";
659 Opt->type = TYPE_STRING;
660 Opt->key_desc =
"name";
664 Opt->options =
"rgb,hex,hsv,triplet";
665 Opt->label = _(
"Color format");
666 Opt->description = _(
"Color format for output values.");
668 (
char **)&(Opt->descriptions),
"rgb;%s;hex;%s;hsv;%s;triplet;%s",
669 _(
"output color in RGB format"), _(
"output color in HEX format"),
670 _(
"output color in HSV format (experimental)"),
671 _(
"output color in colon-separated RGB format"));
678 Opt->type = TYPE_STRING;
679 Opt->key_desc =
"name";
681 Opt->gisprompt =
"old,dir,dir";
682 Opt->description = _(
"Name of input directory");
687 Opt->type = TYPE_STRING;
690 Opt->options =
"miles,feet,meters,kilometers,acres,hectares";
691 Opt->description = _(
"Units");
694 case G_OPT_M_DATATYPE:
696 Opt->key_desc =
"datatype";
697 Opt->type = TYPE_STRING;
700 Opt->description = _(
"Data type(s)");
705 Opt->type = TYPE_STRING;
708 Opt->key_desc =
"name";
709 Opt->gisprompt =
"old,mapset,mapset";
710 Opt->label = _(
"Name of mapset (default: current search path)");
711 Opt->description = _(
"'.' for current mapset");
714 case G_OPT_M_LOCATION:
715 Opt->key =
"project";
716 Opt->type = TYPE_STRING;
719 Opt->label = _(
"Project (location) name");
720 Opt->description = _(
"Project name (not path to project)");
721 Opt->gisprompt =
"old,location,location";
722 Opt->key_desc =
"name";
727 Opt->type = TYPE_STRING;
730 Opt->label = _(
"GRASS database directory");
731 Opt->description = _(
"Default: path to the current GRASS database");
732 Opt->gisprompt =
"old,dbase,dbase";
733 Opt->key_desc =
"path";
737 Opt->key =
"coordinates";
738 Opt->type = TYPE_DOUBLE;
741 Opt->key_desc =
"east,north";
742 Opt->gisprompt =
"old,coords,coords";
743 Opt->description = _(
"Coordinates");
748 Opt->key_desc =
"style";
749 Opt->type = TYPE_STRING;
752 Opt->description = _(
"Name of color table");
754 Opt->gisprompt =
"old,colortable,colortable";
757 case G_OPT_M_NULL_VALUE:
758 Opt->key =
"null_value";
759 Opt->key_desc =
"string";
760 Opt->type = TYPE_STRING;
763 Opt->description = _(
"String representing NULL value");
768 Opt->type = TYPE_STRING;
769 Opt->key_desc =
"name";
771 Opt->gisprompt =
"old,windows,region";
772 Opt->description = _(
"Name of saved region");
777 Opt->type = TYPE_INTEGER;
784 if (memstr && *memstr)
785 Opt->answer = memstr;
787 Opt->label = _(
"Number of threads for parallel computing");
788 Opt->description = _(
"0: use OpenMP default; >0: use nprocs; "
789 "<0: use MAX-nprocs");
794 Opt->type = TYPE_INTEGER;
796 Opt->label = _(
"Seed value for the random number generator");
798 _(
"Using the same seed ensures identical results, "
799 "while a randomly generated seed produces different outcomes "
804 case G_OPT_STDS_INPUT:
806 Opt->type = TYPE_STRING;
807 Opt->key_desc =
"name";
809 Opt->gisprompt =
"old,stds,stds";
810 Opt->description = _(
"Name of the input space time dataset");
812 case G_OPT_STDS_INPUTS:
814 Opt->type = TYPE_STRING;
815 Opt->key_desc =
"name";
818 Opt->gisprompt =
"old,stds,stds";
819 Opt->description = _(
"Name of the input space time datasets");
821 case G_OPT_STDS_OUTPUT:
823 Opt->type = TYPE_STRING;
824 Opt->key_desc =
"name";
826 Opt->gisprompt =
"new,stds,stds";
827 Opt->description = _(
"Name of the output space time dataset");
829 case G_OPT_STRDS_INPUT:
831 Opt->type = TYPE_STRING;
832 Opt->key_desc =
"name";
834 Opt->gisprompt =
"old,strds,strds";
835 Opt->description = _(
"Name of the input space time raster dataset");
837 case G_OPT_STRDS_INPUTS:
839 Opt->type = TYPE_STRING;
840 Opt->key_desc =
"name";
843 Opt->gisprompt =
"old,strds,strds";
844 Opt->description = _(
"Name of the input space time raster datasets");
846 case G_OPT_STRDS_OUTPUT:
848 Opt->type = TYPE_STRING;
849 Opt->key_desc =
"name";
851 Opt->gisprompt =
"new,strds,strds";
852 Opt->description = _(
"Name of the output space time raster dataset");
854 case G_OPT_STRDS_OUTPUTS:
855 Opt->key =
"outputs";
856 Opt->type = TYPE_STRING;
857 Opt->key_desc =
"name";
860 Opt->gisprompt =
"new,strds,strds";
861 Opt->description = _(
"Name of the output space time raster datasets");
863 case G_OPT_STVDS_INPUT:
865 Opt->type = TYPE_STRING;
866 Opt->key_desc =
"name";
868 Opt->gisprompt =
"old,stvds,stvds";
869 Opt->description = _(
"Name of the input space time vector dataset");
871 case G_OPT_STVDS_INPUTS:
873 Opt->type = TYPE_STRING;
874 Opt->key_desc =
"name";
877 Opt->gisprompt =
"old,stvds,stvds";
878 Opt->description = _(
"Name of the input space time vector datasets");
880 case G_OPT_STVDS_OUTPUT:
882 Opt->type = TYPE_STRING;
883 Opt->key_desc =
"name";
885 Opt->gisprompt =
"new,stvds,stvds";
886 Opt->description = _(
"Name of the output space time vector dataset");
888 case G_OPT_STR3DS_INPUT:
890 Opt->type = TYPE_STRING;
891 Opt->key_desc =
"name";
893 Opt->gisprompt =
"old,str3ds,str3ds";
894 Opt->description = _(
"Name of the input space time raster3d dataset");
896 case G_OPT_STR3DS_INPUTS:
898 Opt->type = TYPE_STRING;
899 Opt->key_desc =
"name";
902 Opt->gisprompt =
"old,str3ds,str3ds";
903 Opt->description = _(
"Name of the input space time raster3d datasets");
905 case G_OPT_STR3DS_OUTPUT:
907 Opt->type = TYPE_STRING;
908 Opt->key_desc =
"name";
910 Opt->gisprompt =
"new,str3ds,str3ds";
911 Opt->description = _(
"Name of the output space time raster3d dataset");
913 case G_OPT_STDS_TYPE:
915 Opt->type = TYPE_STRING;
916 Opt->key_desc =
"name";
918 Opt->answer =
"strds";
919 Opt->options =
"strds,stvds,str3ds";
920 Opt->description = _(
"Type of the input space time dataset");
922 case G_OPT_MAP_INPUT:
924 Opt->type = TYPE_STRING;
925 Opt->key_desc =
"name";
927 Opt->gisprompt =
"old,map,map";
928 Opt->description = _(
"Name of the input map");
930 case G_OPT_MAP_INPUTS:
932 Opt->type = TYPE_STRING;
933 Opt->key_desc =
"name";
936 Opt->gisprompt =
"old,map,map";
937 Opt->description = _(
"Name of the input maps");
941 Opt->type = TYPE_STRING;
942 Opt->key_desc =
"name";
944 Opt->answer =
"raster";
945 Opt->options =
"raster,vector,raster_3d";
946 Opt->description = _(
"Type of the input map");
949 Opt->key =
"temporaltype";
950 Opt->type = TYPE_STRING;
951 Opt->key_desc =
"name";
953 Opt->answer =
"absolute";
954 Opt->options =
"absolute,relative";
955 Opt->description = _(
"The temporal type of the space time dataset");
959 Opt->type = TYPE_STRING;
960 Opt->key_desc =
"sql_query";
962 Opt->label = _(
"WHERE conditions of SQL statement without 'where' "
963 "keyword used in the temporal GIS framework");
964 Opt->description = _(
"Example: start_time > '2001-01-01 12:30:00'");
967 Opt->key =
"sampling";
968 Opt->type = TYPE_STRING;
969 Opt->key_desc =
"name";
972 Opt->answer =
"start";
973 Opt->options =
"start,during,overlap,contain,equal,follows,precedes";
975 _(
"The method to be used for sampling the input dataset");
979 Opt->type = TYPE_STRING;
980 Opt->key_desc =
"name";
982 Opt->label = _(
"Output format");
983 Opt->answer =
"plain";
984 Opt->options =
"plain,json";
985 Opt->descriptions = _(
"plain;Plain text output;"
986 "json;JSON (JavaScript Object Notation);");
1020 Flg->description = _(
"Do not create attribute table");
1024 Flg->label = _(
"Do not build topology");
1026 _(
"Advantageous when handling a large number of points");
int G_asprintf(char **out, const char *fmt,...)
char * G_color_rules_options(void)
Get list of color rules for Option->options.
char * G_color_rules_description_type(void)
Get color rules description for Option->descriptions.
const char * G_getenv_nofatal(const char *name)
Get environment variable.
struct Option * G_define_option(void)
Initializes an Option struct.
struct Flag * G_define_flag(void)
Initializes a Flag struct.
struct Option * G_define_standard_option(int opt)
Create standardised Option structure.
struct Flag * G_define_standard_flag(int flag)
Create standardised Flag structure.
char * G_store(const char *s)
Copy string to allocated memory.