浏览代码

v.neighbors: more reasonable warnings

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62745 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 10 年之前
父节点
当前提交
d8ef09a2d5
共有 2 个文件被更改,包括 9 次插入6 次删除
  1. 8 5
      vector/v.neighbors/main.c
  2. 1 1
      vector/v.neighbors/v.neighbors.html

+ 8 - 5
vector/v.neighbors/main.c

@@ -8,7 +8,7 @@
  *               
  * PURPOSE:      Category manipulations
  *               
- * COPYRIGHT:    (C) 2001-2009 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2001-2014 by the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2).  Read the file COPYING that
@@ -36,7 +36,7 @@ int main(int argc, char *argv[])
     struct Option *in_opt, *out_opt, *field_opt;
     struct Option *method_opt, *size_opt;
     struct Map_info In;
-    double radius, raster_res;
+    double radius, grid_res;
     struct boxlist *List;
     struct Cell_head region;
     struct bound_box box;
@@ -91,6 +91,10 @@ int main(int argc, char *argv[])
     G_get_set_window(&region);
     nrows = Rast_window_rows();
     ncols = Rast_window_cols();
+    grid_res = (region.ew_res + region.ns_res)/2.;
+    if ( atof(size_opt->answer) < grid_res)
+	G_warning(_("Neighborhood diameter smaller than cell resolution: %.1f < %.1f "),
+		  radius * 2., grid_res);
 
     result = Rast_allocate_buf(CELL_TYPE);
     Points = Vect_new_line_struct();
@@ -157,9 +161,8 @@ int main(int argc, char *argv[])
     Rast_close(out_fd);
 
     if (count_sum < 1) {
-	raster_res = (region.ew_res + region.ns_res)/2.;
-	G_warning(_("No points found (using raster resolution: %.1f, moving window size: %.1f)"),
-			raster_res, (box.E - box.W) * raster_res );
+	G_warning(_("No points found (using cell resolution: %.1f, neighborhood diameter: %.1f)"),
+			grid_res, radius * 2.);
 	G_message(_("You can calculate the distance statistics between the vector point using:\nv.univar -d %s"), in_opt->answer);
 	exit(EXIT_FAILURE);
     }

+ 1 - 1
vector/v.neighbors/v.neighbors.html

@@ -10,7 +10,7 @@ Count the number of schools for a given grid (North Carolina sample
 dataset):
 
 <div class="code"><pre>
-g.region vect=schools_wake res=10 -p
+g.region vect=schools_wake res=100 -p -a
 v.neighbors input=schools_wake output=schools_wake_3000m method=count size=3000
 
 d.mon wx0