[GRASS-dev] g.parser and link a relation between parameters

Pietro peter.zamb at gmail.com
Wed Mar 25 00:59:03 PDT 2015


Hi devs,

may be I'm missing something stupid, but if I want to write a GRASS
modules that takes two different vectors and allows for each vetor to
select a column, something like:

{{{
#%module
#% description: Test
#% keyword: vector
#%end
#%option G_OPT_V_INPUT
#% key: vect0
#%end
#%option G_OPT_V_FIELD
#% key: vect0_layer
#% required: no
#%end
#%option G_OPT_DB_COLUMN
#% key: vect0_column_cost
#%end
#%option G_OPT_DB_COLUMN
#% key: vect0_column_maintenance
#%end
#%option G_OPT_V_INPUT
#% key: vect1
#%end
#%option G_OPT_V_FIELD
#% key: vect1_layer
#% required: no
#%end
#%option G_OPT_DB_COLUMN
#% key: vect0_column_other
#%end
#%option G_OPT_V_OUTPUT
#%end
from pprint import pprint
import grass.script.core as gcore


def main(options, flags):
    pprint(options)
    pprint(flags)

if __name__ == "__main__":
    main(*gcore.parser())
}}}

How can I say to WxGui that vect0_column_cost should display a
combobox with the available columns of the table linked with a layer
specify in vect0_layer of the vector map with name specify in vect0?

For the GRASS addons and GUI that we are developing we decide to use
the same root word: "vect0" and "vect1" to link the different
parameters to the vector, there are any better way to solve this? May
be something that it is working natively in GRASS?

Thank you for your help.

Pietro


More information about the grass-dev mailing list