[GRASS-SVN] r70813 - grass/branches/releasebranch_7_2/scripts/v.import

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 28 17:13:25 PDT 2017


Author: annakrat
Date: 2017-03-28 17:13:25 -0700 (Tue, 28 Mar 2017)
New Revision: 70813

Modified:
   grass/branches/releasebranch_7_2/scripts/v.import/v.import.py
Log:
v.import: move testing if the data are of the same CRS before creating temporary location (merge from trunk, r70519)

Modified: grass/branches/releasebranch_7_2/scripts/v.import/v.import.py
===================================================================
--- grass/branches/releasebranch_7_2/scripts/v.import/v.import.py	2017-03-28 14:30:11 UTC (rev 70812)
+++ grass/branches/releasebranch_7_2/scripts/v.import/v.import.py	2017-03-29 00:13:25 UTC (rev 70813)
@@ -182,6 +182,20 @@
     if output:
         vopts['output'] = output
     vopts['snap'] = options['snap']
+
+    # try v.in.ogr directly
+    if flags['o'] or grass.run_command('v.in.ogr', input=OGRdatasource, flags='j',
+                                       errors='status', quiet=True, overwrite=overwrite) == 0:
+        try:
+            grass.run_command('v.in.ogr', input=OGRdatasource,
+                              flags=vflags, overwrite=overwrite, **vopts)
+            grass.message(
+                _("Input <%s> successfully imported without reprojection") %
+                OGRdatasource)
+            return 0
+        except CalledModuleError:
+            grass.fatal(_("Unable to import <%s>") % OGRdatasource)
+
     try:
         grass.run_command('v.in.ogr', input=OGRdatasource,
                           location=TMPLOC, flags='i', quiet=True, overwrite=overwrite, **vopts)
@@ -200,19 +214,6 @@
     # switch to target location
     os.environ['GISRC'] = str(tgtgisrc)
 
-    # try v.in.ogr directly
-    if flags['o'] or grass.run_command('v.in.ogr', input=OGRdatasource, flags='j',
-                                       errors='status', quiet=True, overwrite=overwrite) == 0:
-        try:
-            grass.run_command('v.in.ogr', input=OGRdatasource,
-                              flags=vflags, overwrite=overwrite, **vopts)
-            grass.message(
-                _("Input <%s> successfully imported without reprojection") %
-                OGRdatasource)
-            return 0
-        except CalledModuleError:
-            grass.fatal(_("Unable to import <%s>") % OGRdatasource)
-
     # make sure target is not xy
     if grass.parse_command('g.proj', flags='g')['name'] == 'xy_location_unprojected':
         grass.fatal(



More information about the grass-commit mailing list