[GRASS-dev] [GRASS GIS] #1522: dbm_base.py fails with multilayer maps

#1522: dbm_base.py fails with multilayer maps
----------------------+-----------------------------------------------------
Reporter: artegion | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.2
Component: wxGUI | Version: 6.4.2 RCs
Keywords: | Platform: All
      Cpu: All |
----------------------+-----------------------------------------------------
map 'test' has two layers

Layer=1 Category=20 Table=net_table
Layer=2 Category=8 Table=links

Traceback (most recent call last):
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/mapdisp_window.py", line
1017, in MouseActions
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/mapdisp_window.py", line
1207, in OnLeftUp
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/mapdisp.py", line 1382, in
QueryVector
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/dbm_dialogs.py", line 102,
in __init__
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/dbm_dialogs.py", line 360,
in UpdateDialog
   File
"C:\Programmi\Grass\etc\wxpython\gui_modules\dbm_base.py",
line 109, in SelectByPoint

if self.tables[table][key]['ctype'] != types.StringType:
KeyError
:
'STATUS'

v.what works fine

>> ret = grass.read_command('v.what',
                        quiet = True,
                        flags = 'ag',
                        map = 'test',
                        east_north = '60.0,70.0',
                        distance = '1.0')
>> ret
East=60
North=70
Map=test
Mapset=piacenza
Type=Line

Id=20
Length=20.000000
Layer=1
Category=20
Driver=sqlite
Database=d:\gis_db\gauss-boaga\test_sqlite.db
Table=net_table
Key_column=cat
cat=20
net=
Layer=2
Category=8
Driver=sqlite
Database=d:\gis_db\gauss-boaga\test_sqlite.db
Table=links
Key_column=cat
cat=8
ID=12
LTYPE=1
NODE1=12
NODE2=13
LENGTH=5280
DIAMETER=10
ROUGHNESS=100
MLOSS=0
STATUS=Open
PARAMETERS=
TYPE=
SETTINGS=
TAG=ID12

but grass.vector_what puts Layer 2 attributes into Layer 1

>>data = grass.vector_what(map = 'test',coord = (60.0, 70.0), distance =
1.0)
>>data
[{'Category': 20,
'Map': 'test',
'Layer': 1,
'Key_column': 'cat',
'Database': 'd:\\gis_db\\gauss-boaga\\test_sqlite.db',
'Mapset': 'piacenza',
'Driver': 'sqlite',
'Length': '20.000000',
'Attributes': {'STATUS': 'Open',
                'LTYPE': '1',
                'PARAMETERS': '',
                'DIAMETER': '10',
                'SETTINGS': '',
                'MLOSS': '0',
                'cat': '8',
                'LENGTH': '5280',
                'TAG': 'ID12',
                'NODE1': '12',
                'NODE2': '13',
                'TYPE': '',
                'ID': '12',
                'ROUGHNESS': '100'},
'Table': 'net_table',
'Type': 'Line',
'Id': 20}]

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1522&gt;
GRASS GIS <http://grass.osgeo.org>

#1522: dbm_base.py fails with multilayer maps
----------------------+-----------------------------------------------------
Reporter: artegion | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.2
Component: wxGUI | Version: 6.4.2 RCs
Keywords: | Platform: All
      Cpu: All |
----------------------+-----------------------------------------------------

Comment(by artegion):

but from Digitize "Diplay/update attributes" button (wxPython) it
works......

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1522#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1522: dbm_base.py fails with multilayer maps
----------------------+-----------------------------------------------------
Reporter: artegion | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.2
Component: wxGUI | Version: 6.4.2 RCs
Keywords: | Platform: All
      Cpu: All |
----------------------+-----------------------------------------------------

Old description:

map 'test' has two layers

Layer=1 Category=20 Table=net_table
Layer=2 Category=8 Table=links

Traceback (most recent call last):
  File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/mapdisp_window.py", line
1017, in MouseActions
  File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/mapdisp_window.py", line
1207, in OnLeftUp
  File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/mapdisp.py", line 1382, in
QueryVector
  File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/dbm_dialogs.py", line 102,
in __init__
  File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/dbm_dialogs.py", line 360,
in UpdateDialog
  File
"C:\Programmi\Grass\etc\wxpython\gui_modules\dbm_base.py",
line 109, in SelectByPoint

if self.tables[table][key]['ctype'] != types.StringType:
KeyError
:
'STATUS'

v.what works fine

>> ret = grass.read_command('v.what',
                       quiet = True,
                       flags = 'ag',
                       map = 'test',
                       east_north = '60.0,70.0',
                       distance = '1.0')
>> ret
East=60
North=70
Map=test
Mapset=piacenza
Type=Line

Id=20
Length=20.000000
Layer=1
Category=20
Driver=sqlite
Database=d:\gis_db\gauss-boaga\test_sqlite.db
Table=net_table
Key_column=cat
cat=20
net=
Layer=2
Category=8
Driver=sqlite
Database=d:\gis_db\gauss-boaga\test_sqlite.db
Table=links
Key_column=cat
cat=8
ID=12
LTYPE=1
NODE1=12
NODE2=13
LENGTH=5280
DIAMETER=10
ROUGHNESS=100
MLOSS=0
STATUS=Open
PARAMETERS=
TYPE=
SETTINGS=
TAG=ID12

but grass.vector_what puts Layer 2 attributes into Layer 1

>>data = grass.vector_what(map = 'test',coord = (60.0, 70.0), distance =
1.0)
>>data
[{'Category': 20,
'Map': 'test',
'Layer': 1,
'Key_column': 'cat',
'Database': 'd:\\gis_db\\gauss-boaga\\test_sqlite.db',
'Mapset': 'piacenza',
'Driver': 'sqlite',
'Length': '20.000000',
'Attributes': {'STATUS': 'Open',
               'LTYPE': '1',
               'PARAMETERS': '',
               'DIAMETER': '10',
               'SETTINGS': '',
               'MLOSS': '0',
               'cat': '8',
               'LENGTH': '5280',
               'TAG': 'ID12',
               'NODE1': '12',
               'NODE2': '13',
               'TYPE': '',
               'ID': '12',
               'ROUGHNESS': '100'},
'Table': 'net_table',
'Type': 'Line',
'Id': 20}]

New description:

map 'test' has two layers
{{{
Layer=1 Category=20 Table=net_table
Layer=2 Category=8 Table=links
}}}
{{{
Traceback (most recent call last):
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/mapdisp_window.py", line
1017, in MouseActions
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/mapdisp_window.py", line
1207, in OnLeftUp
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/mapdisp.py", line 1382, in
QueryVector
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/dbm_dialogs.py", line 102,
in __init__
   File "c:/osgeo4w/usr/src/grass-6.4.2RC2/dist.i686-pc-
mingw32/etc/wxpython/gui_modules/dbm_dialogs.py", line 360,
in UpdateDialog
   File
"C:\Programmi\Grass\etc\wxpython\gui_modules\dbm_base.py",
line 109, in SelectByPoint

if self.tables[table][key]['ctype'] != types.StringType:
KeyError
:
'STATUS'
}}}

v.what works fine
{{{
>> ret = grass.read_command('v.what',
                        quiet = True,
                        flags = 'ag',
                        map = 'test',
                        east_north = '60.0,70.0',
                        distance = '1.0')
>> ret
East=60
North=70
Map=test
Mapset=piacenza
Type=Line

Id=20
Length=20.000000
Layer=1
Category=20
Driver=sqlite
Database=d:\gis_db\gauss-boaga\test_sqlite.db
Table=net_table
Key_column=cat
cat=20
net=
Layer=2
Category=8
Driver=sqlite
Database=d:\gis_db\gauss-boaga\test_sqlite.db
Table=links
Key_column=cat
cat=8
ID=12
LTYPE=1
NODE1=12
NODE2=13
LENGTH=5280
DIAMETER=10
ROUGHNESS=100
MLOSS=0
STATUS=Open
PARAMETERS=
TYPE=
SETTINGS=
TAG=ID12
}}}

but grass.vector_what puts Layer 2 attributes into Layer 1
{{{
>>data = grass.vector_what(map = 'test',coord = (60.0, 70.0), distance =
1.0)
>>data
[{'Category': 20,
'Map': 'test',
'Layer': 1,
'Key_column': 'cat',
'Database': 'd:\\gis_db\\gauss-boaga\\test_sqlite.db',
'Mapset': 'piacenza',
'Driver': 'sqlite',
'Length': '20.000000',
'Attributes': {'STATUS': 'Open',
                'LTYPE': '1',
                'PARAMETERS': '',
                'DIAMETER': '10',
                'SETTINGS': '',
                'MLOSS': '0',
                'cat': '8',
                'LENGTH': '5280',
                'TAG': 'ID12',
                'NODE1': '12',
                'NODE2': '13',
                'TYPE': '',
                'ID': '12',
                'ROUGHNESS': '100'},
'Table': 'net_table',
'Type': 'Line',
'Id': 20}]
}}}

--

Comment(by hamish):

verbatim formatting applied to ticket description.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1522#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1522: dbm_base.py fails with multilayer maps
-------------------------+--------------------------------------------------
Reporter: artegion | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.2
Component: wxGUI | Version: 6.4.2 RCs
Keywords: vector_what | Platform: All
      Cpu: All |
-------------------------+--------------------------------------------------
Changes (by hamish):

  * keywords: => vector_what

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1522#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1522: dbm_base.py fails with multilayer maps
-------------------------+--------------------------------------------------
Reporter: artegion | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.2
Component: wxGUI | Version: 6.4.2 RCs
Keywords: vector_what | Platform: All
      Cpu: All |
-------------------------+--------------------------------------------------

Comment(by wenzeslaus):

The vector_what function (file vector.py) should by fixed in GRASS 7 in
r52824.

vector_what tested with some handmade maps with multiple layers (with and
without dblink). Please, confirm.

This blocked (or blocks) #1606 (part of #1606 is duplicate of this
ticked).

(vector_what is used only in the GUI so r52824 should not break anything.)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1522#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1522: dbm_base.py fails with multilayer maps
-------------------------+--------------------------------------------------
Reporter: artegion | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.2
Component: wxGUI | Version: 6.4.2 RCs
Keywords: vector_what | Platform: All
      Cpu: All |
-------------------------+--------------------------------------------------

Comment(by annakrat):

Another related change: r52832. Please test it so that it can be
backported before release.

Thanks, Anna

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1522#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1522: dbm_base.py fails with multilayer maps
-----------------------+----------------------------------------------------
  Reporter: artegion | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: critical | Milestone: 6.4.2
Component: wxGUI | Version: 6.4.2 RCs
Resolution: fixed | Keywords: vector_what
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Changes (by annakrat):

  * status: new => closed
  * resolution: => fixed

Comment:

It seems to work, related ticket #1606 was closed as fixed. Backported in
r52853, r52855.

Anna

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1522#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>