[GRASS-SVN] r32750 - grass/branches/develbranch_6/vector/v.distance
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Aug 13 15:52:37 EDT 2008
Author: mlennert
Date: 2008-08-13 15:52:37 -0400 (Wed, 13 Aug 2008)
New Revision: 32750
Modified:
grass/branches/develbranch_6/vector/v.distance/description.html
grass/branches/develbranch_6/vector/v.distance/main.c
Log:
added dmin (merge from trunk, r32748)
Modified: grass/branches/develbranch_6/vector/v.distance/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.distance/description.html 2008-08-13 19:51:39 UTC (rev 32749)
+++ grass/branches/develbranch_6/vector/v.distance/description.html 2008-08-13 19:52:37 UTC (rev 32750)
@@ -5,7 +5,7 @@
information about the vectors' relationships (distance, category, etc.) may be uploaded
to the attribute table attached to the first vector map, or printed to
'stdout'. A new vector map may be created where lines connecting
-nearest points on features are written.
+nearest points on features are written. <em>dmin</em> and/or <em>dmax</em> can be used to limit the search radius.
<H2>NOTES</H2>
Modified: grass/branches/develbranch_6/vector/v.distance/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.distance/main.c 2008-08-13 19:51:39 UTC (rev 32749)
+++ grass/branches/develbranch_6/vector/v.distance/main.c 2008-08-13 19:52:37 UTC (rev 32750)
@@ -78,12 +78,12 @@
struct GModule *module;
struct Option *from_opt, *to_opt, *from_type_opt, *to_type_opt,
*from_field_opt, *to_field_opt;
- struct Option *out_opt, *max_opt, *table_opt;
+ struct Option *out_opt, *max_opt, *min_opt, *table_opt;
struct Option *upload_opt, *column_opt, *to_column_opt;
struct Flag *print_flag, *all_flag;
struct Map_info From, To, Out, *Outp;
int from_type, to_type, from_field, to_field;
- double max;
+ double max, min;
struct line_pnts *FPoints, *TPoints;
struct line_cats *FCats, *TCats;
NEAR *Near, *near;
@@ -163,6 +163,13 @@
max_opt->answer = "-1";
max_opt->description = _("Maximum distance or -1 for no limit");
+ min_opt = G_define_option();
+ min_opt->key = "dmin";
+ min_opt->type = TYPE_DOUBLE;
+ min_opt->required = NO;
+ min_opt->answer = "-1";
+ min_opt->description = _("Minimum distance or -1 for no limit");
+
upload_opt = G_define_option();
upload_opt->key = "upload";
upload_opt->type = TYPE_STRING;
@@ -226,6 +233,7 @@
to_field = atoi(to_field_opt->answer);
max = atof(max_opt->answer);
+ min = atof(min_opt->answer);
if (all_flag->answer)
all = 1;
@@ -539,7 +547,7 @@
Vect_point_on_line(TPoints, tmp_talong, NULL, NULL, NULL,
&tmp_tangle, NULL);
- if (tmp_dist > max)
+ if (tmp_dist > max || tmp_dist < min)
continue; /* not in threshold */
/* TODO: more cats of the same field */
More information about the grass-commit
mailing list