On 04/08/08 13:39, gianluca massei wrote:
Hy list,
I'm writing a C module for multiciriteria decision analysis in GRASS.

Great news ! I'm very interested in this.

If you haven't already, you might want to have a look at the old r.infer and r.weight modules in grass5.4. Also see the GRASS news article by Peter Löwe: http://grass.itc.it/newsletter/grassnews3.html.

Just one suggestion: it might be worthwhile thinking about error handling/propagation in such a module...

I've a problem with doublevalue  multiple answers processing.
The code is like that:
"
/    weight = G_define_option();
 weight->key        = "weight";
 weight->type       = TYPE_DOUBLE;
 weight->required   = YES;
weight->multiple = YES; weight->description = _("Criteria weight(s) (w1,w2,..)");/
"

I'd like extract single value so, I tried this:
"
/    for(i=0;i<ncriteria;i++)
     {
     G_message(_("Peso %d : %lf"),i,weight->answers[i]);
     }/
"

Not sure, but I think the ->answers are always string, so you have to transform to float with atof:

G_message(_("Peso %d : %lf"),i,atof(weight->answers[i]));

Moritz
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to