[GRASS-SVN] r53456 - in grass/branches/develbranch_6: gui/wxpython/location_wizard lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Oct 17 13:27:15 PDT 2012
Author: neteler
Date: 2012-10-17 13:27:14 -0700 (Wed, 17 Oct 2012)
New Revision: 53456
Modified:
grass/branches/develbranch_6/gui/wxpython/location_wizard/wizard.py
grass/branches/develbranch_6/lib/python/core.py
Log:
backport of r53316 and r53317 (from trunk); fixes trac #1748 and #1452
Modified: grass/branches/develbranch_6/gui/wxpython/location_wizard/wizard.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/location_wizard/wizard.py 2012-10-17 20:25:53 UTC (rev 53455)
+++ grass/branches/develbranch_6/gui/wxpython/location_wizard/wizard.py 2012-10-17 20:27:14 UTC (rev 53456)
@@ -892,8 +892,10 @@
# proj4string = self.parent.CreateProj4String() + ' +datum=%s' % self.datum
ret = RunCommand('g.proj',
read = True,
- proj4 = '%s +datum=%s' % (proj, self.datum),
+ proj4 = '%s' % proj,
+ datum = '%s' % self.datum,
datumtrans = '-1')
+# wx.Messagebox('here')
if ret != '':
dtrans = ''
# open a dialog to select datum transform number
@@ -1617,6 +1619,7 @@
location = self.parent.startpage.location
proj4string = self.parent.CreateProj4String()
epsgcode = self.parent.epsgpage.epsgcode
+ datum = self.parent.datumpage.datum
dtrans = self.parent.datumtrans
global coordsys
@@ -1625,6 +1628,7 @@
ret, projlabel, err = RunCommand('g.proj',
flags = 'jf',
proj4 = proj4string,
+ datum = datum,
datumtrans = dtrans,
location = location,
getErrorMsg = True,
@@ -1640,6 +1644,8 @@
finishButton = wx.FindWindowById(wx.ID_FORWARD)
if ret == 0:
+ if datum != '':
+ projlabel = projlabel + ' ' + 'datum=%s' % datum
self.lproj4string.SetLabel(projlabel.replace(' ', os.linesep))
finishButton.Enable(True)
else:
@@ -1966,7 +1972,8 @@
grass.create_location(dbase = self.startpage.grassdatabase,
location = self.startpage.location,
proj4 = self.CreateProj4String(),
- datum = self.datumtrans,
+ datum = self.datumpage.datum,
+ datumtrans = self.datumtrans,
desc = self.startpage.locTitle)
elif coordsys == 'custom':
grass.create_location(dbase = self.startpage.grassdatabase,
@@ -1980,7 +1987,8 @@
grass.create_location(dbase = self.startpage.grassdatabase,
location = self.startpage.location,
epsg = self.epsgpage.epsgcode,
- datum = self.datumtrans,
+ datum = self.datumpage.datum,
+ datumtrans = self.datumtrans,
desc = self.startpage.locTitle)
elif coordsys == "file":
if not self.filepage.georeffile or \
@@ -2013,7 +2021,7 @@
projdesc = self.projpage.projdesc
proj4params = self.paramspage.p4projparams
- datum = self.datumpage.datum
+# datum = self.datumpage.datum
if self.datumpage.datumdesc:
datumdesc = self.datumpage.datumdesc +' - ' + self.datumpage.ellipse
else:
@@ -2038,9 +2046,7 @@
item = ' +' + item
proj4string = '%s %s' % (proj4string, item)
- # set datum and transform parameters if relevant
- if datum != '':
- proj4string = '%s +datum=%s' % (proj4string, datum)
+ # set datum transform parameters if relevant
if datumparams:
for item in datumparams:
proj4string = '%s +%s' % (proj4string,item)
Modified: grass/branches/develbranch_6/lib/python/core.py
===================================================================
--- grass/branches/develbranch_6/lib/python/core.py 2012-10-17 20:25:53 UTC (rev 53455)
+++ grass/branches/develbranch_6/lib/python/core.py 2012-10-17 20:27:14 UTC (rev 53456)
@@ -1052,18 +1052,19 @@
def create_location(dbase, location,
epsg = None, proj4 = None, filename = None, wkt = None,
- datum = None, desc = None):
+ datum = None, datumtrans = None, desc = None):
"""!Create new location
Raise ScriptError on error.
@param dbase path to GRASS database
@param location location name to create
- @param epgs if given create new location based on EPSG code
+ @param epsg if given create new location based on EPSG code
@param proj4 if given create new location based on Proj4 definition
@param filename if given create new location based on georeferenced file
@param wkt if given create new location based on WKT definition (path to PRJ file)
- @param datum datum transformation parameters (used for epsg and proj4)
+ @param datum GRASS format datum code
+ @param datumtrans datum transformation parameters (used for epsg and proj4)
@param desc description of the location (creates MYNAME file)
"""
gisdbase = None
@@ -1077,11 +1078,12 @@
kwargs = dict()
if datum:
kwargs['datum'] = datum
+ if datumtrans:
+ kwargs['datumtrans'] = datumtrans
if epsg:
ps = pipe_command('g.proj',
quiet = True,
- flags = 'c',
epsg = epsg,
location = location,
stderr = PIPE,
@@ -1089,7 +1091,6 @@
elif proj4:
ps = pipe_command('g.proj',
quiet = True,
- flags = 'c',
proj4 = proj4,
location = location,
stderr = PIPE,
@@ -1097,14 +1098,12 @@
elif filename:
ps = pipe_command('g.proj',
quiet = True,
- flags = 'c',
georef = filename,
location = location,
stderr = PIPE)
elif wkt:
ps = pipe_command('g.proj',
quiet = True,
- flags = 'c',
wkt = wkt,
location = location,
stderr = PIPE)
More information about the grass-commit
mailing list