[GRASS-dev] georect.py

Hello list,

working on grass6.5.0 (revision 36499), I met a problem with the
geo-rectify tool.

After pointing the first tic, when trying to navigate in the image to be
rectified, the display freezes. The following message appears right at
the moment we click the first tic :

        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1737, in OnLeftUp
        
        self.UpdateMap(render=False, renderVector=False)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1737, in OnLeftUp
        
        self.UpdateMap(render=False, renderVector=False)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1702, in OnLeftUp
        
        self.UpdateMap(render=True)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1702, in OnLeftUp
        
        self.UpdateMap(render=True)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1702, in OnLeftUp
        
        self.UpdateMap(render=True)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1702, in OnLeftUp
        
        self.UpdateMap(render=True)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1702, in OnLeftUp
        
        self.UpdateMap(render=True)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1702, in OnLeftUp
        
        self.UpdateMap(render=True)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1702, in OnLeftUp
        
        self.UpdateMap(render=True)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1702, in OnLeftUp
        
        self.UpdateMap(render=True)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1007, in MouseActions
        
        self.OnLeftUp(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1702, in OnLeftUp
        
        self.UpdateMap(render=True)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 999, in MouseActions
        
        self.OnMouseWheel(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1057, in OnMouseWheel
        
        self.UpdateMap()
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'
        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 999, in MouseActions
        
        self.OnMouseWheel(event)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 1057, in OnMouseWheel
        
        self.UpdateMap()
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 881, in DrawGCP
        
        5]})
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 983, in DrawCross
        
        pdctype='text', coords=coord)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 366, in Draw
        
        pdc.DrawText(img['text'], coords[0], coords[1])
          File "/usr/local/grass-6.5.svn/etc/wxpython/vdigit/grass6_
        wxvdigit.py", line 372, in DrawText
        
        def DrawText(*args): return
        _grass6_wxvdigit.PseudoDC_DrawText(*args)
        TypeError
        :
        in method 'PseudoDC_DrawText', argument 3 of type 'int'

Could the source of this problem be my configuration of wxpython ? (no
errors detected at compilation)

Thanks,
Vincent.

Hi,

2009/3/28 Vincent Bain <bain@toraval.fr>:

   pdctype=&#39;text&#39;, coords=coord\)
     File &quot;/usr/local/grass\-6\.5\.svn/etc/wxpython/gui\_modules/ma
   pdisp\_window\.py&quot;, line 366, in Draw

try to put before this line

print type(coords[0]), type(coords[1])

<type 'int'> <type 'int'> should be printed.

[...]

   pdc\.DrawText\(img\[&#39;text&#39;\], coords\[0\], coords\[1\]\)
     File &quot;/usr/local/grass\-6\.5\.svn/etc/wxpython/vdigit/grass6\_
   wxvdigit\.py&quot;, line 372, in DrawText

   def DrawText\(\*args\): return
   \_grass6\_wxvdigit\.PseudoDC\_DrawText\(\*args\)
   TypeError
   :
   in method &#39;PseudoDC\_DrawText&#39;, argument 3 of type &#39;int&#39;

Could the source of this problem be my configuration of wxpython ? (no
errors detected at compilation)

It's related to the local copy of PseudoDC from vdigit. BTW, which
version of swig are you using?

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Le samedi 28 mars 2009 à 14:29 +0100, Martin Landa a écrit :

Hi,

2009/3/28 Vincent Bain <bain@toraval.fr>:
> pdctype='text', coords=coord)
> File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
> pdisp_window.py", line 366, in Draw

try to put before this line

print type(coords[0]), type(coords[1])

<type 'int'> <type 'int'> should be printed.

modified the file the way you suggest, but the command now returns <type
'float'> <type 'float'> instead.

It's related to the local copy of PseudoDC from vdigit. BTW, which
version of swig are you using?

swig -version :
1.3.36

VB

Hi,

2009/3/28 Vincent Bain <bain@toraval.fr>:

Le samedi 28 mars 2009 à 14:29 +0100, Martin Landa a écrit :

try to put before this line

print type(coords[0]), type(coords[1])

<type 'int'> <type 'int'> should be printed.

modified the file the way you suggest, but the command now returns <type
'float'> <type 'float'> instead.

It's related to the local copy of PseudoDC from vdigit. BTW, which
version of swig are you using?

Hopefully fixed in r36503.

M.

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Thank you Martin, it is fixed !

again in the georectify module, a display error occurs when trying to
resume a previous referencing session (ie when some gcp where already
defined for a given raster) -- not crucial in fact.

The error message is the following :

        Traceback (most recent call last):
          File "/usr/local/grass-6.5.svn/etc/wxpython/wxgui.py",
        line 361, in OnGeorectify
        
        georect.GeorectWizard(self)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 196, in __init__
        
        self.gcpmgr.SetMapDisplay(self.xy_mapdisp)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 792, in SetMapDisplay
        
        self.list.LoadData()
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 1292, in LoadData
        
        self.gcp.ReadGCPs()
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 990, in ReadGCPs
        
        sourceMapWin.UpdateMap(render=False, renderVector=False)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ma
        pdisp_window.py", line 725, in UpdateMap
        
        self.parent.GetLayerManager().georectifying.DrawGCP(coordtyp
        e)
          File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/ge
        orect.py", line 858, in DrawGCP
        
        wxCol = wx.Colour(col[0], col[1], col[2], 255)
          File "/usr/lib/python2.5/site-
        packages/wx-2.8-gtk2-unicode/wx/_gdi.py", line 114, in
        __init__
        
        _gdi_.Colour_swiginit(self,_gdi_.new_Colour(*args,
        **kwargs))
        TypeError
        :
        in method 'new_Colour', expected argument 1 of type 'byte'
        
Vincent