[GRASS-SVN] r72865 - grass/trunk/scripts/v.rast.stats
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 21 09:50:09 PDT 2018
Author: mlennert
Date: 2018-06-21 09:50:09 -0700 (Thu, 21 Jun 2018)
New Revision: 72865
Modified:
grass/trunk/scripts/v.rast.stats/v.rast.stats.py
Log:
v.rast.stats: check for existence of attribute table before launching v.to.rast
Modified: grass/trunk/scripts/v.rast.stats/v.rast.stats.py
===================================================================
--- grass/trunk/scripts/v.rast.stats/v.rast.stats.py 2018-06-21 16:01:17 UTC (rev 72864)
+++ grass/trunk/scripts/v.rast.stats/v.rast.stats.py 2018-06-21 16:50:09 UTC (rev 72865)
@@ -119,6 +119,15 @@
if vect_mapset != mapset or not grass.find_file(vector, 'vector', mapset)['file']:
grass.fatal(_("Vector map <%s> not found in current mapset") % vector)
+ # check if DBF driver used, in this case cut to 10 chars col names:
+ try:
+ fi = grass.vector_db(map=vector)[int(layer)]
+ except KeyError:
+ grass.fatal(
+ _('There is no table connected to this map. Run v.db.connect or v.db.addtable first.'))
+ # we need this for non-DBF driver:
+ dbfdriver = fi['driver'] == 'dbf'
+
vector = vs[0]
rastertmp = "%s_%s" % (vector, tmpname)
@@ -159,15 +168,6 @@
if number < 1:
grass.fatal(_("No categories found in raster map"))
- # check if DBF driver used, in this case cut to 10 chars col names:
- try:
- fi = grass.vector_db(map=vector)[int(layer)]
- except KeyError:
- grass.fatal(
- _('There is no table connected to this map. Run v.db.connect or v.db.addtable first.'))
- # we need this for non-DBF driver:
- dbfdriver = fi['driver'] == 'dbf'
-
# Find out which table is linked to the vector map on the given layer
if not fi['table']:
grass.fatal(
More information about the grass-commit
mailing list