[GRASS-SVN] r70519 - grass/trunk/scripts/v.import

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 9 12:27:06 PST 2017


Author: annakrat
Date: 2017-02-09 12:27:06 -0800 (Thu, 09 Feb 2017)
New Revision: 70519

Modified:
   grass/trunk/scripts/v.import/v.import.py
Log:
v.import: move testing if the data are of the same CRS before creating temporary location

Modified: grass/trunk/scripts/v.import/v.import.py
===================================================================
--- grass/trunk/scripts/v.import/v.import.py	2017-02-09 16:49:00 UTC (rev 70518)
+++ grass/trunk/scripts/v.import/v.import.py	2017-02-09 20:27:06 UTC (rev 70519)
@@ -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