Re: [GRASS-user] script option

2018-07-16 Thread Nikos Alexandris

* Frank David  [2018-07-14 12:13:26 +0200]:


Hi Nikos,

You can find below the full interface script. The script is not yet 
finished. It may be helps you to understand the problem ?!
I don't really understand how works the parameter guidependency and 
with which key I must connect it. I did not find any doc about that.. 
do you know where I can find that ?


Frank, I don't know this option!

The search hits I can quickly find:
- 
https://grass.osgeo.org/grass74/manuals/libpython/script.html?highlight=guidependency.
- https://trac.osgeo.org/grass/search?q=guidependency

It is not mentioned in
https://grass.osgeo.org/grass75/manuals/g.parser.html. I think it
should.

A couple of grass-addons use it:

grass7/db/db.join/db.join.py:46:#% guidependency: ocolumn,scolumns
grass7/vector/v.stream.network/v.stream.network.py:38:#%  guidependency: 
layer,column
grass7/vector/v.civil/v.civil.py:72:##% guidependency: ocolumn,scolumns
grass7/vector/v.civil/v.civil.py:80:##% guidependency: ocolumn,scolumns
grass7/vector/v.gsflow.export/v.gsflow.export.py:36:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:43:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:50:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:57:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:64:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:71:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:78:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:85:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:92:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:99:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.export/v.gsflow.export.py:106:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.gravres/v.gsflow.gravres.py:38:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.gravres/v.gsflow.gravres.py:45:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.gravres/v.gsflow.gravres.py:52:#%  guidependency: 
layer,column
grass7/vector/v.flexure/v.flexure.py:37:#%  guidependency: layer,column
grass7/vector/v.flexure/v.flexure.py:43:#%  guidependency: column
grass7/vector/v.gsflow.segments/v.gsflow.segments.py:36:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.segments/v.gsflow.segments.py:43:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.reaches/v.gsflow.reaches.py:37:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.reaches/v.gsflow.reaches.py:44:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.reaches/v.gsflow.reaches.py:51:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.reaches/v.gsflow.reaches.py:58:#%  guidependency: 
layer,column
grass7/vector/v.stream.inbasin/v.stream.inbasin.py:50:#%  guidependency: 
layer,column
grass7/vector/v.stream.inbasin/v.stream.inbasin.py:57:#%  guidependency: 
layer,column
grass7/vector/v.stream.inbasin/v.stream.inbasin.py:64:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.hruparams/v.gsflow.hruparams.py:37:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.hruparams/v.gsflow.hruparams.py:44:#%  guidependency: 
layer,column
grass7/vector/v.gsflow.hruparams/v.gsflow.hruparams.py:51:#%  guidependency: 
layer,column
grass7/gui/wxpython/wx.metadata/t.info.iso/t.info.iso.py:25:#% guidependency: 
input

Something new to learn.

Nikos


signature.asc
Description: PGP signature
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] script option

2018-07-14 Thread Frank David


Le 13/07/2018 à 21:51, Nikos Alexandris a écrit :

* Frank David  [2018-07-13 19:26:36 +0200]:




Le 11/07/2018 à 09:31, Nikos Alexandris a écrit :

* Frank David  [2018-07-10 15:44:51 +0200]:




Le 10/07/2018 à 12:25, Nikos Alexandris a écrit :

* frank  [2018-07-10 08:05:29 +0200]:


Hi dear grass users,

I'm trying to get two field name of an attribute table (ctx_map) 
by the options of the gui. But I can access only at the first one 
and I don't find why...??. See my code below :


#%option G_OPT_V_MAP
#% key: ctx_map
#% description: vector data
#% required : yes
#% guidependency:layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: wf name
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: wtg name
#% required: yes
#%end

Thank you for your help.
Frank


Dear Frank,

Hello Nikos,


if you refer to the last two "column" options,
how do you try to access these, in the script?

Like,

options['ctx_wf']
options['ctx_wtg']

Absolutely


?

Also, what .xml does

x.ScriptName --interface-description

generate?
There is no error on compilation, and help tab display Flags and 
Parameters information, like (french accent are not well encoded):


Parameters:
obj_map=name [required]
Name of vector map
MH ou WTG projet
obj_layer=string
Layer number or name
Vector features can have category values in different layers. This 
number determines which layer to use. When used with direct OGR 
access this is the layer name.

Default: 1
obj_name=name [required]
Nom de l'objet
*ctx_map=name [required] **
**Name of vector map **
*Contexte éolien *
**ctx_layer=string **
**Layer number or name **
**Vector features can have category values in different layers. 
This number determines which layer to use. When used with direct 
OGR access this is the layer name. **

**Default: 1 **
**ctx_wf=name [required] **
*Nom du parc *
**ctx_wtg=name [required] **
*Identifiant éolienne


Ah, and what does `x.ScriptName --ui` return?
Maybe an encoding related issue? Related entries in trac:
https://trac.osgeo.org/grass/search?q=encoding+french=1=on=on=on=on 




Nikos

Hello Nikos,

x.myscript --ui just launch the gui box.
I have found a trick to run the script. Actually I need one field 
from on vector table and 2 fields from an other vector table. like 
that it works :


#%option G_OPT_V_MAP
#% label: MH ou WTG projet
#% required : yes
#% guidependency: layer,obj
#%end
#%option G_OPT_V_FIELD
#% guidependency: obj
#%end
#%option G_OPT_DB_COLUMN
#% key: obj
#% description: Nom de l'objet
#% required: yes
#%end


#%option G_OPT_V_MAP
#% key: ctx_map
#% label: Contexte éolien
#% required : yes
#% guidependency:ctx_layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: Nom du parc
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: Identifiant éolienne
#% required: yes
#%end

But as soon as I try to name myself the first table by Key parameter 
like #%key : obj_map and add key name at layer (like in the second 
part of the code) It does not work anymore... It looks like the fisrt 
map is automatically named "map" by the gui. I don't mind but I find 
this strange. I'm sure there is a explanation,somewhere...

Cheers,
Frank


Perhaps there is something, and experienced developers will notice it 
fast.

Yet, why don't you share a minimal working code? At least the interface,
so I can try myself to compile. Even in private if you
prefer. I am willig to help in understanding this error. So I will learn
about it as well.

Nikos

Hi Nikos,

You can find below the full interface script. The script is not yet 
finished. It may be helps you to understand the problem ?!
I don't really understand how works the parameter guidependency and with 
which key I must connect it. I did not find any doc about that.. do you 
know where I can find that ?


Thanks
Frank


#!/usr/bin/python
#-*-coding:UTF-8 -*-

#%Module
#% description: Calcul de l'intervisibilité entre WTG projet et contexte 
ou objets MH et WTG projet

#% keyword: display
#% keyword: raster
#% keyword: windfarm
#%End

#%option G_OPT_V_MAP
#% label: MH ou WTG projet
#% required : yes
#% guidependency: layer,obj
#%end
#%option G_OPT_V_FIELD
#% guidependency: obj
#%end
#%option G_OPT_DB_COLUMN
#% key: obj
#% description: Nom de l'objet
#% required: yes
#%end


#%option G_OPT_V_MAP
#% key: ctx_map
#% label: Contexte éolien
#% required : yes
#% guidependency:ctx_layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: Nom du parc
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: Identifiant éolienne
#% required: yes
#%end

#%Option
#% key: string_zvi_obj
#% type: string
#% answer : 

Re: [GRASS-user] script option

2018-07-13 Thread Nikos Alexandris

* Frank David  [2018-07-13 19:26:36 +0200]:




Le 11/07/2018 à 09:31, Nikos Alexandris a écrit :

* Frank David  [2018-07-10 15:44:51 +0200]:




Le 10/07/2018 à 12:25, Nikos Alexandris a écrit :

* frank  [2018-07-10 08:05:29 +0200]:


Hi dear grass users,

I'm trying to get two field name of an attribute table 
(ctx_map) by the options of the gui. But I can access only at 
the first one and I don't find why...??. See my code below :


#%option G_OPT_V_MAP
#% key: ctx_map
#% description: vector data
#% required : yes
#% guidependency:layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: wf name
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: wtg name
#% required: yes
#%end

Thank you for your help.
Frank


Dear Frank,

Hello Nikos,


if you refer to the last two "column" options,
how do you try to access these, in the script?

Like,

options['ctx_wf']
options['ctx_wtg']

Absolutely


?

Also, what .xml does

x.ScriptName --interface-description

generate?
There is no error on compilation, and help tab display Flags and 
Parameters information, like (french accent are not well encoded):


Parameters:
obj_map=name [required]
Name of vector map
MH ou WTG projet
obj_layer=string
Layer number or name
Vector features can have category values in different layers. This 
number determines which layer to use. When used with direct OGR 
access this is the layer name.

Default: 1
obj_name=name [required]
Nom de l'objet
*ctx_map=name [required] **
**Name of vector map **
*Contexte éolien *
**ctx_layer=string **
**Layer number or name **
**Vector features can have category values in different layers. 
This number determines which layer to use. When used with direct 
OGR access this is the layer name. **

**Default: 1 **
**ctx_wf=name [required] **
*Nom du parc *
**ctx_wtg=name [required] **
*Identifiant éolienne


Ah, and what does `x.ScriptName --ui` return?
Maybe an encoding related issue? Related entries in trac:
https://trac.osgeo.org/grass/search?q=encoding+french=1=on=on=on=on


Nikos

Hello Nikos,

x.myscript --ui just launch the gui box.
I have found a trick to run the script. Actually I need one field from 
on vector table and 2 fields from an other vector table. like that it 
works :


#%option G_OPT_V_MAP
#% label: MH ou WTG projet
#% required : yes
#% guidependency: layer,obj
#%end
#%option G_OPT_V_FIELD
#% guidependency: obj
#%end
#%option G_OPT_DB_COLUMN
#% key: obj
#% description: Nom de l'objet
#% required: yes
#%end


#%option G_OPT_V_MAP
#% key: ctx_map
#% label: Contexte éolien
#% required : yes
#% guidependency:ctx_layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: Nom du parc
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: Identifiant éolienne
#% required: yes
#%end

But as soon as I try to name myself the first table by Key parameter 
like #%key : obj_map and add key name at layer (like in the second 
part of the code) It does not work anymore... It looks like the fisrt 
map is automatically named "map" by the gui. I don't mind but I find 
this strange. I'm sure there is a explanation,somewhere...

Cheers,
Frank


Perhaps there is something, and experienced developers will notice it fast.
Yet, why don't you share a minimal working code? At least the interface,
so I can try myself to compile. Even in private if you
prefer. I am willig to help in understanding this error. So I will learn
about it as well.

Nikos


signature.asc
Description: PGP signature
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] script option

2018-07-13 Thread Frank David



Le 11/07/2018 à 09:31, Nikos Alexandris a écrit :

* Frank David  [2018-07-10 15:44:51 +0200]:




Le 10/07/2018 à 12:25, Nikos Alexandris a écrit :

* frank  [2018-07-10 08:05:29 +0200]:


Hi dear grass users,

I'm trying to get two field name of an attribute table (ctx_map) by 
the options of the gui. But I can access only at the first one and 
I don't find why...??. See my code below :


#%option G_OPT_V_MAP
#% key: ctx_map
#% description: vector data
#% required : yes
#% guidependency:layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: wf name
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: wtg name
#% required: yes
#%end

Thank you for your help.
Frank


Dear Frank,

Hello Nikos,


if you refer to the last two "column" options,
how do you try to access these, in the script?

Like,

options['ctx_wf']
options['ctx_wtg']

Absolutely


?

Also, what .xml does

x.ScriptName --interface-description

generate?
There is no error on compilation, and help tab display Flags and 
Parameters information, like (french accent are not well encoded):


Parameters:
obj_map=name [required]
Name of vector map
MH ou WTG projet
obj_layer=string
Layer number or name
Vector features can have category values in different layers. This 
number determines which layer to use. When used with direct OGR 
access this is the layer name.

Default: 1
obj_name=name [required]
Nom de l'objet
*ctx_map=name [required] **
**Name of vector map **
*Contexte éolien *
**ctx_layer=string **
**Layer number or name **
**Vector features can have category values in different layers. This 
number determines which layer to use. When used with direct OGR 
access this is the layer name. **

**Default: 1 **
**ctx_wf=name [required] **
*Nom du parc *
**ctx_wtg=name [required] **
*Identifiant éolienne


Ah, and what does `x.ScriptName --ui` return?
Maybe an encoding related issue? Related entries in trac:
https://trac.osgeo.org/grass/search?q=encoding+french=1=on=on=on=on 



Nikos

Hello Nikos,

x.myscript --ui just launch the gui box.
I have found a trick to run the script. Actually I need one field from 
on vector table and 2 fields from an other vector table. like that it 
works :


#%option G_OPT_V_MAP
#% label: MH ou WTG projet
#% required : yes
#% guidependency: layer,obj
#%end
#%option G_OPT_V_FIELD
#% guidependency: obj
#%end
#%option G_OPT_DB_COLUMN
#% key: obj
#% description: Nom de l'objet
#% required: yes
#%end


#%option G_OPT_V_MAP
#% key: ctx_map
#% label: Contexte éolien
#% required : yes
#% guidependency:ctx_layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: Nom du parc
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: Identifiant éolienne
#% required: yes
#%end

But as soon as I try to name myself the first table by Key parameter 
like #%key : obj_map and add key name at layer (like in the second part 
of the code) It does not work anymore... It looks like the fisrt map is 
automatically named "map" by the gui. I don't mind but I find this 
strange. I'm sure there is a explanation,somewhere...

Cheers,
Frank

--
*Geophom*
327 rue de Vieille Cour 44521 OUDON
Tel +33(0)2 85 52 02 59 - Port +33(0)6 04 47 91 06
www.geophom.fr
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] script option

2018-07-11 Thread Nikos Alexandris

* Frank David  [2018-07-10 15:44:51 +0200]:




Le 10/07/2018 à 12:25, Nikos Alexandris a écrit :

* frank  [2018-07-10 08:05:29 +0200]:


Hi dear grass users,

I'm trying to get two field name of an attribute table (ctx_map) 
by the options of the gui. But I can access only at the first one 
and I don't find why...??. See my code below :


#%option G_OPT_V_MAP
#% key: ctx_map
#% description: vector data
#% required : yes
#% guidependency:layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: wf name
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: wtg name
#% required: yes
#%end

Thank you for your help.
Frank


Dear Frank,

Hello Nikos,


if you refer to the last two "column" options,
how do you try to access these, in the script?

Like,

options['ctx_wf']
options['ctx_wtg']

Absolutely


?

Also, what .xml does

x.ScriptName --interface-description

generate?
There is no error on compilation, and help tab display Flags and 
Parameters information, like (french accent are not well encoded):


Parameters:
obj_map=name [required]
Name of vector map
MH ou WTG projet
obj_layer=string
Layer number or name
Vector features can have category values in different layers. This 
number determines which layer to use. When used with direct OGR access 
this is the layer name.

Default: 1
obj_name=name [required]
Nom de l'objet
*ctx_map=name [required] **
**Name of vector map **
*Contexte éolien *
**ctx_layer=string **
**Layer number or name **
**Vector features can have category values in different layers. This 
number determines which layer to use. When used with direct OGR access 
this is the layer name. **

**Default: 1 **
**ctx_wf=name [required] **
*Nom du parc *
**ctx_wtg=name [required] **
*Identifiant éolienne


Ah, and what does `x.ScriptName --ui` return?
Maybe an encoding related issue? Related entries in trac:
https://trac.osgeo.org/grass/search?q=encoding+french=1=on=on=on=on

Nikos


signature.asc
Description: PGP signature
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] script option

2018-07-10 Thread Frank David



Le 10/07/2018 à 12:25, Nikos Alexandris a écrit :

* frank  [2018-07-10 08:05:29 +0200]:


Hi dear grass users,

I'm trying to get two field name of an attribute table (ctx_map) by 
the options of the gui. But I can access only at the first one and I 
don't find why...??. See my code below :


#%option G_OPT_V_MAP
#% key: ctx_map
#% description: vector data
#% required : yes
#% guidependency:layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: wf name
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: wtg name
#% required: yes
#%end

Thank you for your help.
Frank


Dear Frank,

Hello Nikos,


if you refer to the last two "column" options,
how do you try to access these, in the script?

Like,

options['ctx_wf']
options['ctx_wtg']

Absolutely


?

Also, what .xml does

x.ScriptName --interface-description

generate?
There is no error on compilation, and help tab display Flags and 
Parameters information, like (french accent are not well encoded):


Parameters:
obj_map=name [required]
Name of vector map
MH ou WTG projet
obj_layer=string
Layer number or name
Vector features can have category values in different layers. This 
number determines which layer to use. When used with direct OGR access 
this is the layer name.

Default: 1
obj_name=name [required]
Nom de l'objet
*ctx_map=name [required] **
**Name of vector map **
*Contexte éolien *
**ctx_layer=string **
**Layer number or name **
**Vector features can have category values in different layers. This 
number determines which layer to use. When used with direct OGR access 
this is the layer name. **

**Default: 1 **
**ctx_wf=name [required] **
*Nom du parc *
**ctx_wtg=name [required] **
*Identifiant éolienne


Nikos

Frank



--
*Geophom*
327 rue de Vieille Cour 44521 OUDON
Tel +33(0)2 85 52 02 59 - Port +33(0)6 04 47 91 06
www.geophom.fr
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] script option

2018-07-10 Thread Nikos Alexandris

* frank  [2018-07-10 08:05:29 +0200]:


Hi dear grass users,

I'm trying to get two field name of an attribute table (ctx_map) by 
the options of the gui. But I can access only at the first one and I 
don't find why...??. See my code below :


#%option G_OPT_V_MAP
#% key: ctx_map
#% description: vector data
#% required : yes
#% guidependency:layer,ctx_wf,ctx_wtg
#%end
#%option G_OPT_V_FIELD
#% key:ctx_layer
#% guidependency:ctx_wf,ctx_wtg
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wf
#% description: wf name
#% required: yes
#%end
#%option G_OPT_DB_COLUMN
#% key:ctx_wtg
#% description: wtg name
#% required: yes
#%end

Thank you for your help.
Frank


Dear Frank,

if you refer to the last two "column" options,
how do you try to access these, in the script?

Like,

options['ctx_wf']
options['ctx_wtg']

?

Also, what .xml does

x.ScriptName --interface-description

generate?

Nikos


signature.asc
Description: PGP signature
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user