[GRASS-SVN] r66466 - in grass/branches/releasebranch_7_0/scripts: . r.import v.import

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 10 11:00:10 PDT 2015


Author: annakrat
Date: 2015-10-10 11:00:10 -0700 (Sat, 10 Oct 2015)
New Revision: 66466

Added:
   grass/branches/releasebranch_7_0/scripts/r.import/
   grass/branches/releasebranch_7_0/scripts/v.import/
Removed:
   grass/branches/releasebranch_7_0/scripts/r.import/testsuite/
Modified:
   grass/branches/releasebranch_7_0/scripts/Makefile
   grass/branches/releasebranch_7_0/scripts/v.import/v.import.py
Log:
add v.import/r.import from trunk

Modified: grass/branches/releasebranch_7_0/scripts/Makefile
===================================================================
--- grass/branches/releasebranch_7_0/scripts/Makefile	2015-10-10 16:59:10 UTC (rev 66465)
+++ grass/branches/releasebranch_7_0/scripts/Makefile	2015-10-10 18:00:10 UTC (rev 66466)
@@ -33,6 +33,7 @@
 	r.colors.stddev \
 	r.fillnulls \
 	r.grow \
+	r.import \
 	r.in.aster \
 	r.in.srtm \
 	r.in.wms \
@@ -59,6 +60,7 @@
 	v.db.univar \
 	v.db.update \
 	v.dissolve \
+	v.import \
 	v.in.e00 \
 	v.in.geonames \
 	v.in.lines \

Modified: grass/branches/releasebranch_7_0/scripts/v.import/v.import.py
===================================================================
--- grass/trunk/scripts/v.import/v.import.py	2015-10-10 15:13:34 UTC (rev 66462)
+++ grass/branches/releasebranch_7_0/scripts/v.import/v.import.py	2015-10-10 18:00:10 UTC (rev 66466)
@@ -22,12 +22,10 @@
 #% keyword: import
 #% keyword: projection
 #%end
-#%option
+#%option G_OPT_F_BIN_INPUT
 #% key: input
-#% type: string
 #% required: yes
 #% description: Name of OGR datasource to be imported
-#% gisprompt: old,datasource,datasource
 #% guisection: Input
 #%end
 #%option
@@ -36,7 +34,6 @@
 #% multiple: yes
 #% description: OGR layer name. If not given, all available layers are imported
 #% guisection: Input
-#% gisprompt: old,datasource_layer,datasource_layer
 #%end
 #%option G_OPT_V_OUTPUT
 #% description: Name for output vector map (default: input)
@@ -148,12 +145,15 @@
     # switch to temp location
     os.environ['GISRC'] = str(SRCGISRC)
 
+    # compare source and target srs
+    insrs = grass.read_command('g.proj', flags='j', quiet=True)
+
     # switch to target location
     os.environ['GISRC'] = str(tgtgisrc)
 
-    # try v.in.ogr directly
-    if grass.run_command('v.in.ogr', input=OGRdatasource, flags='j',
-                         errors='status', quiet=True) == 0:
+    if insrs == tgtsrs:
+        # try v.in.ogr directly
+        grass.message(_("Importing <%s>...") % OGRdatasource) 
         try:
             grass.run_command('v.in.ogr', input=OGRdatasource,
                               flags=vflags, **vopts)



More information about the grass-commit mailing list