[GRASS-SVN] r59477 - grass-addons/grass7/vector/v.what.strds
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 27 12:19:20 PDT 2014
Author: lucadelu
Date: 2014-03-27 12:19:20 -0700 (Thu, 27 Mar 2014)
New Revision: 59477
Modified:
grass-addons/grass7/vector/v.what.strds/v.what.strds.py
Log:
v.what.strds: check if vector has a table
Modified: grass-addons/grass7/vector/v.what.strds/v.what.strds.py
===================================================================
--- grass-addons/grass7/vector/v.what.strds/v.what.strds.py 2014-03-27 19:16:36 UTC (rev 59476)
+++ grass-addons/grass7/vector/v.what.strds/v.what.strds.py 2014-03-27 19:19:20 UTC (rev 59477)
@@ -45,6 +45,7 @@
import grass.temporal as tgis
from grass.pygrass.functions import copy as gcopy
from grass.pygrass.messages import Messenger
+from grass.pygrass.vector import Vector
############################################################################
@@ -173,6 +174,18 @@
msgr = Messenger()
perc_curr = 0
perc_tot = len(samples)
+ pymap = Vector(output)
+ try:
+ pymap.open()
+ except:
+ dbif.close()
+ grass.fatal(_("It is not possible to open the new map %s" % output))
+
+ if len(pymap.dblinks) == 0:
+ ret = grass.run_command("v.db.addtable", map=output)
+ if ret != 0:
+ dbif.close()
+ grass.fatal(_("Impossible add table to vector %s" % output))
for sample in samples:
raster_names = sample.raster_names
# Call v.what.rast for each raster map
More information about the grass-commit
mailing list