[GRASS-SVN] r56162 - grass/trunk/gui/wxpython/location_wizard

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 8 04:29:01 PDT 2013


Author: hamish
Date: 2013-05-08 04:29:01 -0700 (Wed, 08 May 2013)
New Revision: 56162

Modified:
   grass/trunk/gui/wxpython/location_wizard/wizard.py
Log:
fix for traceback when specifying by proj4 terms (#1849) and when ellipsoid is used instead of datum (#1967), merge from devbr6

Modified: grass/trunk/gui/wxpython/location_wizard/wizard.py
===================================================================
--- grass/trunk/gui/wxpython/location_wizard/wizard.py	2013-05-08 11:05:01 UTC (rev 56161)
+++ grass/trunk/gui/wxpython/location_wizard/wizard.py	2013-05-08 11:29:01 UTC (rev 56162)
@@ -21,14 +21,15 @@
  - wizard::LocationWizard
  - wizard::WizardWithHelpButton
 
-(C) 2007-2012 by the GRASS Development Team
+(C) 2007-2013 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
 
 @author Michael Barton
 @author Jachym Cepicky
- at author Martin Landa <landa.martin gmail.com>   
+ at author Martin Landa <landa.martin gmail.com>
+ at author Hamish Bowman (planetary ellipsoids)
 """
 import os
 import locale
@@ -746,7 +747,7 @@
             paramSBSizer.Fit(self.panel)
             self.panel.SetSizer(self.prjParamSizer)
                     
-        if event.GetDirection(): 
+        if event.GetDirection():
             self.prjParamSizer.Clear(True)
             self.paramSBox.SetLabel(_(" Enter parameters for %s projection ") % self.projdesc)
             self.pparam = dict()
@@ -761,7 +762,7 @@
                 # default values
                 if param['type'] == 'bool':
                     param['value'] = 0
-                elif param['type'] == 'zone': 
+                elif param['type'] == 'zone':
                     param['value'] = 30 
                     param['desc'] += ' (1-60)'
                 else:
@@ -1081,6 +1082,8 @@
           and self.ellipse not in self.parent.planetary_ellipsoids:
             event.Veto()
 
+        #print self.ellipse, self.ellipsedesc, self.ellipseparams
+
         self.proj4params = ''
         self.GetNext().SetPrev(self)
         self.parent.datumpage.datumparams = ''
@@ -1106,6 +1109,7 @@
             self.ellipsedesc = self.parent.planetary_ellipsoids[self.ellipse][0]
             self.ellipseparams = self.parent.planetary_ellipsoids[self.ellipse][1]
             nextButton.Enable(True)
+        #print self.ellipse, self.ellipsedesc, self.ellipseparams
 
     def OnSearch(self, event):
         """!Search ellipsoid by desc"""
@@ -1386,7 +1390,7 @@
             if not self.epsgcode:
                 event.Veto()
                 return
-            else:              
+            else:
                 # check for datum transforms
                 ret = RunCommand('g.proj',
                                  read = True,
@@ -1441,7 +1445,7 @@
             self.tcode.SetValue('')
             self.searchb.SetValue('')
             self.OnBrowseCodes(None)
-        else:    
+        else:
             try:
                 self.epsgcode, self.epsgdesc, self.epsgparams = \
                         self.epsglist.Search(index=[0,1,2], pattern=value)
@@ -1559,7 +1563,7 @@
                 
                 if dlg.ShowModal() == wx.ID_OK:
                     dtrans = dlg.GetTransform()
-                    if len(dtrans) == 0:
+                    if dtrans == '':
                         dlg.Destroy()
                         event.Veto()
                         return _('Datum transform is required.')
@@ -1674,18 +1678,23 @@
         epsgcode = self.parent.epsgpage.epsgcode
         datum = self.parent.datumpage.datum
         dtrans = self.parent.datum_trans
-        
         global coordsys
+
+        #print coordsys,proj4string
         if coordsys in ('proj', 'epsg'):
             if coordsys == 'proj':
+                addl_opts = {}
+                if len(datum) > 0:
+                    addl_opts['datum'] = '%s' % datum
+                    addl_opts['datumtrans'] = dtrans
+
                 ret, projlabel, err = RunCommand('g.proj',
                                                  flags = 'jf',
                                                  proj4 = proj4string,
-                                                 datum = datum,
-                                                 datum_trans = dtrans,
                                                  location = location,
                                                  getErrorMsg = True,
-                                                 read = True)
+                                                 read = True,
+                                                 **addl_opts)
             elif coordsys == 'epsg':
                 ret, projlabel, err = RunCommand('g.proj',
                                                  flags = 'jf',
@@ -1709,6 +1718,7 @@
         projdesc = self.parent.projpage.projdesc
         ellipsedesc = self.parent.ellipsepage.ellipsedesc
         datumdesc = self.parent.datumpage.datumdesc
+        #print projdesc,ellipsedesc,datumdesc
         self.ldatabase.SetLabel(database)
         self.llocation.SetLabel(location)
         self.llocTitle.SetLabel(self.parent.startpage.locTitle)
@@ -1865,7 +1875,7 @@
                 self.grassdatabase = self.startpage.grassdatabase
                 self.georeffile = self.filepage.georeffile
                 # FIXME here was code for setting default region, what for is this if:
-                # if self.altdb == False: 
+                # if self.altdb == False:
                     
             else: # -> error
                 self.wizard.Destroy()



More information about the grass-commit mailing list