[GRASSLIST:3462] Re: writing ascii files from two different raster maps

Glynn Clements glynn.clements at virgin.net
Thu May 20 20:30:55 EDT 2004

Jaime Carrera wrote:

> I'm trying to write a module in order to write an ascii file from two
> or more different raster files. Can I use two different options or
> should I use the multiple = YES option in G_define_option(). To
> clarify my question I have the following examples:
> CASE 1:
> inputone=G_define_option()
> inputone-> key            ="firstinput";
> inputone-> type           =TYPE_STRING;
> inputone->required       =YES;
> inputone->gisprompt    = "old, cell,raster";
> inputone->description   ="Name of input layer no 1";
> inputtwo=G_define_option()
> inputtwo-> key            ="secondinput";
> inputtwo-> type           =TYPE_STRING;
> inputtwo->required       =YES;
> inputtwo->gisprompt    = "old, cell,raster";
> inputtwo->description   ="Name of input layer no 2";
> CASE 2:
> input =G_define_option()
> input-> key            ="firstinput";
> input -> type           =TYPE_STRING;
> input->required       =YES;
> input->multiple       =YES;
> input ->gisprompt    = "old, cell,raster";
> input->description   ="Name of input layer";

It entirely depends upon the nature of the module. If it will always
require exactly two inputs, it's probably best to use the first
option. If the process can be generalised to any number of inputs, use
the second option.

> In case I need to use the second case, how can I control the way in
> which the ascii file is written (I need to write in the ASCII file
> other parameters between each raster layer).

I don't see how that is related to the way in which the inputs are

The only significant difference between the two cases is that in the
first case the map names will be in inputone->answer and
inputtwo->answer, while in the second case they will be in
input->answers[0] and input->answers[1].

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-user mailing list