浏览代码

v.vect.stats: less cryptic error message; type casting hints added

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74168 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 6 年之前
父节点
当前提交
36d0da1e41
共有 3 个文件被更改,包括 12 次插入3 次删除
  1. 2 0
      scripts/v.db.update/v.db.update.py
  2. 1 1
      vector/v.vect.stats/main.c
  3. 9 2
      vector/v.vect.stats/v.vect.stats.html

+ 2 - 0
scripts/v.db.update/v.db.update.py

@@ -20,6 +20,8 @@
 #% keyword: vector
 #% keyword: vector
 #% keyword: attribute table
 #% keyword: attribute table
 #% keyword: database
 #% keyword: database
+#% keyword: attribute update
+#% keyword: type casting
 #%end
 #%end
 #%option G_OPT_V_MAP
 #%option G_OPT_V_MAP
 #%end
 #%end

+ 1 - 1
vector/v.vect.stats/main.c

@@ -441,7 +441,7 @@ int main(int argc, char *argv[])
 	    db_column_Ctype(Pdriver, PFi->table, point_column_opt->answer);
 	    db_column_Ctype(Pdriver, PFi->table, point_column_opt->answer);
 
 
 	if (ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE)
 	if (ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE)
-	    G_fatal_error(_("column for points vector must be numeric"));
+	    G_fatal_error(_("points_column <%s> of points vector <%s> must be numeric"), point_column_opt->answer, PFi->table);
 
 
 	db_CatValArray_init(&cvarr);
 	db_CatValArray_init(&cvarr);
 	nrec = db_select_CatValArray(Pdriver, PFi->table, PFi->key,
 	nrec = db_select_CatValArray(Pdriver, PFi->table, PFi->key,

+ 9 - 2
vector/v.vect.stats/v.vect.stats.html

@@ -60,9 +60,16 @@ Points not falling into any area are ignored. Areas without category
 (no centroid attached or centroid without category) are ignored. 
 (no centroid attached or centroid without category) are ignored. 
 If no points are falling into a given area, the point count is set to 0
 If no points are falling into a given area, the point count is set to 0
 (zero) and the statistics result to "null".
 (zero) and the statistics result to "null".
-<p>The columns <em>count_column</em> and <em>stats_column</em> are created if not
-existing. If they do already exist, the <em>count_column</em> must be of
+<p>
+The columns <em>count_column</em> and <em>stats_column</em> are created if not
+yet existing. If they do already exist, the <em>count_column</em> must be of
 type integer and the <em>stats_column</em> of type double precision.
 type integer and the <em>stats_column</em> of type double precision.
+<p>
+In case that <em>v.vect.stats</em> complains about the <em>points_column</em>
+of the input points vector map not being numeric, the module
+<em>v.db.update</em> can be used to perform type casting, i.e. adding and
+populating an additional numeric column with the values type converted from
+string attributes to floating point numbers.
 
 
 <h2>EXAMPLES</h2>
 <h2>EXAMPLES</h2>