[GRASS-dev] [GRASS GIS] #2912: raster_what() not compliant with localised version of GRASS

GRASS GIS trac at osgeo.org
Thu Feb 11 01:47:13 PST 2016


#2912: raster_what() not compliant with localised version of GRASS
---------------------------------------------+-------------------------
 Reporter:  andbal                           |      Owner:  grass-dev@…
     Type:  defect                           |     Status:  new
 Priority:  major                            |  Milestone:  7.0.4
Component:  Python                           |    Version:  svn-trunk
 Keywords:  grass.script python translation  |        CPU:  x86-64
 Platform:  Linux                            |
---------------------------------------------+-------------------------
 Writing a python script, I found that the {{{grass.script.raster_what()}}}
 output dictionary has different keys depending on language used in GRASS.
 The following python code:
 {{{#!python
 point = grass.raster_what('clump', [[x,y]])[0]
 print(type(point), point)
 }}}
 returns (with Italian GRASS):
 {{{#!python
 <type 'dict'> {'clump': {'color': '143:247:067', 'etichetta': '',
 'valore': '1'}}
 }}}
 Changing language to English, returns:
 {{{#!python
 <type 'dict'> {'clump': {'color': '151:149:192', 'value': '1', 'label':
 ''}}
 }}}
 Changing language to German, returns:
 {{{#!python
 <type 'dict'> {'clump': {'Farbe': '099:113:108', 'value': '1', 'label':
 ''}}
 }}}
 The translation seems to depend on the GRASS localisations and make
 impossible access to the dictionary keys in a general way.

 Anyway a workaround could be achieved using
 {{{grass.script.read_command('r.what')}}} and accessing to the list
 values.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2912>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list