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

GRASS GIS trac at osgeo.org
Thu Feb 16 19:47:55 EST 2012


#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>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list