[GRASS-SVN] r45727 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 22 10:59:49 EDT 2011


Author: martinl
Date: 2011-03-22 07:59:49 -0700 (Tue, 22 Mar 2011)
New Revision: 45727

Modified:
   grass/trunk/lib/init/grass.py
Log:
startup: support also `-c EPSG:x`


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2011-03-22 14:43:53 UTC (rev 45726)
+++ grass/trunk/lib/init/grass.py	2011-03-22 14:59:49 UTC (rev 45727)
@@ -471,7 +471,14 @@
                             fatal(_("Failed to create new location. The location <%s> already exists." % location_name))
                         sys.path.append(gfile('etc', 'python'))
                         from grass.script import core as grass
-                        grass.create_location(gisdbase, location_name, filename = geofile)
+                        try:
+                            if geofile and geofile.find('EPSG:') > -1:
+                                epsg = geofile.split(':', 1)[1]
+                                grass.create_location(gisdbase, location_name, epsg = epsg)
+                            else:
+                                grass.create_location(gisdbase, location_name, filename = geofile)
+                        except grass.ScriptError, e:
+                            fatal(e.value.strip('"').strip("'").replace('\\n', os.linesep))
 		    else:
                         # create new mapset
 			os.mkdir(location)



More information about the grass-commit mailing list