[GRASS-SVN] r61919 - in grass/branches/releasebranch_7_0: . raster/r.in.lidar vector/v.in.lidar

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 13 14:49:50 PDT 2014


Author: annakrat
Date: 2014-09-13 14:49:50 -0700 (Sat, 13 Sep 2014)
New Revision: 61919

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/raster/r.in.lidar/main.c
   grass/branches/releasebranch_7_0/raster/r.in.lidar/r.in.lidar.html
   grass/branches/releasebranch_7_0/vector/v.in.lidar/main.c
   grass/branches/releasebranch_7_0/vector/v.in.lidar/v.in.lidar.html
Log:
r/v.in.lidar: add class_filter option, rename return_filter option, update man pages, merge from trunk, r61831, r61916, r61918


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61891,61905,61907,61913-61914
   + /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61831,61891,61905,61907,61913-61914,61916,61918

Modified: grass/branches/releasebranch_7_0/raster/r.in.lidar/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.in.lidar/main.c	2014-09-13 21:46:04 UTC (rev 61918)
+++ grass/branches/releasebranch_7_0/raster/r.in.lidar/main.c	2014-09-13 21:49:50 UTC (rev 61919)
@@ -125,6 +125,8 @@
     double pass_north, pass_south;
     int arr_row, arr_col;
     unsigned long count, count_total;
+    int skipme, i;
+    int point_class;
 
     double min = 0.0 / 0.0;	/* init as nan */
     double max = 0.0 / 0.0;	/* init as nan */
@@ -143,7 +145,7 @@
     int r_low, r_up;
 
     struct GModule *module;
-    struct Option *input_opt, *output_opt, *percent_opt, *type_opt, *filter_opt;
+    struct Option *input_opt, *output_opt, *percent_opt, *type_opt, *filter_opt, *class_opt;
     struct Option *method_opt, *zrange_opt, *zscale_opt;
     struct Option *trim_opt, *pth_opt, *res_opt;
     struct Flag *print_flag, *scan_flag, *shell_style, *over_flag, *extents_flag, *intens_flag;
@@ -244,13 +246,22 @@
 	_("Output raster resolution");
 
     filter_opt = G_define_option();
-    filter_opt->key = "filter";
+    filter_opt->key = "return_filter";
     filter_opt->type = TYPE_STRING;
     filter_opt->required = NO;
     filter_opt->label = _("Only import points of selected return type");
     filter_opt->description = _("If not specified, all points are imported");
     filter_opt->options = "first,last,mid";
 
+    class_opt = G_define_option();
+    class_opt->key = "class_filter";
+    class_opt->type = TYPE_INTEGER;
+    class_opt->multiple = YES;
+    class_opt->required = NO;
+    class_opt->label = _("Only import points of selected class(es)");
+    class_opt->description = _("Input is comma separated integers. "
+                               "If not specified, all points are imported.");
+
     print_flag = G_define_flag();
     print_flag->key = 'p';
     print_flag->description =
@@ -775,7 +786,7 @@
 	if (return_filter != LAS_ALL) {
 	    int return_no = LASPoint_GetReturnNumber(LAS_point);
 	    int n_returns = LASPoint_GetNumberOfReturns(LAS_point);
-	    int skipme = 1;
+	    skipme = 1;
 
 	    if (n_returns > 1) {
 
@@ -799,6 +810,21 @@
 		continue;
 	    }
 	}
+	if (class_opt->answer) {
+	    point_class = (int) LASPoint_GetClassification(LAS_point);
+	    i = 0;
+	    skipme = TRUE;
+	    while (class_opt->answers[i]) {
+		if (point_class == atoi(class_opt->answers[i])) {
+		    skipme = FALSE;
+		    break;
+		}
+		i++;
+	    }
+	    if (skipme) {
+		continue;
+	    }
+	}
 
 	    if (y <= pass_south || y > pass_north) {
 		continue;

Modified: grass/branches/releasebranch_7_0/raster/r.in.lidar/r.in.lidar.html
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.in.lidar/r.in.lidar.html	2014-09-13 21:46:04 UTC (rev 61918)
+++ grass/branches/releasebranch_7_0/raster/r.in.lidar/r.in.lidar.html	2014-09-13 21:49:50 UTC (rev 61919)
@@ -89,9 +89,14 @@
 used to obtain a digital surface model (DSM) where e.g. canopy cover is 
 represented. The last return values can be used to obtain a digital 
 terrain model (DTM) where e.g. the forest floor instead of canopy 
-cover is represented. The <b>filter</b> option allows to select one of 
+cover is represented. The <b>return_filter</b> option allows to select one of 
 first, mid, or last returns.
 <p>
+LiDAR points can be already classified into standardized classes. For example,
+class number 2 represents ground (for other classes see LAS format specification
+in references). The <b>class_filter</b> option allows to select one or more 
+classes, as numbers (integers) separated by comma.
+<p>
 The default map <b>type</b>=<tt>FCELL</tt> is intended as compromise between
 preserving data precision and limiting system resource consumption.
 
@@ -280,6 +285,13 @@
 <a href="v.surf.bspline.html">v.surf.bspline</a>
 </em>
 
+<h2>REFERENCES</h2>
+
+<a href="http://www.asprs.org/Committee-General/LASer-LAS-File-Format-Exchange-Activities.html">
+ASPRS LAS format</a><br>
+<a href="http://www.liblas.org/">LAS library</a> <br>
+<a href="http://test.liblas.org/doxygen/liblas_8h.htm">LAS library C API</a> documentation
+
 <h2>AUTHORS</h2>
 
 Markus Metz<br>

Modified: grass/branches/releasebranch_7_0/vector/v.in.lidar/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.in.lidar/main.c	2014-09-13 21:46:04 UTC (rev 61918)
+++ grass/branches/releasebranch_7_0/vector/v.in.lidar/main.c	2014-09-13 21:49:50 UTC (rev 61919)
@@ -111,7 +111,7 @@
     int i;
     float xmin = 0., ymin = 0., xmax = 0., ymax = 0.;
     struct GModule *module;
-    struct Option *in_opt, *out_opt, *spat_opt, *filter_opt;
+    struct Option *in_opt, *out_opt, *spat_opt, *filter_opt, *class_opt;
     struct Option *outloc_opt;
     struct Flag *print_flag, *notab_flag, *region_flag, *notopo_flag;
     struct Flag *over_flag, *extend_flag, *no_import_flag;
@@ -140,12 +140,14 @@
     int las_point_format;
     int have_time, have_color;
     int return_filter;
+    int skipme;
+    int point_class;
     unsigned int not_valid;	
 
     struct line_pnts *Points;
     struct line_cats *Cats;
 
-    unsigned int n_features, feature_count, n_outside, n_filtered;
+    unsigned int n_features, feature_count, n_outside, n_filtered, n_class_filtered;
     int overwrite;
 
     G_gisinit(argv[0]);
@@ -181,13 +183,22 @@
     outloc_opt->key_desc = "name";
     
     filter_opt = G_define_option();
-    filter_opt->key = "filter";
+    filter_opt->key = "return_filter";
     filter_opt->type = TYPE_STRING;
     filter_opt->required = NO;
     filter_opt->label = _("Only import points of selected return type");
     filter_opt->description = _("If not specified, all points are imported");
     filter_opt->options = "first,last,mid";
 
+    class_opt = G_define_option();
+    class_opt->key = "class_filter";
+    class_opt->type = TYPE_INTEGER;
+    class_opt->multiple = YES;
+    class_opt->required = NO;
+    class_opt->label = _("Only import points of selected class(es)");
+    class_opt->description = _("Input is comma separated integers. "
+                               "If not specified, all points are imported.");
+
     print_flag = G_define_flag();
     print_flag->key = 'p';
     print_flag->description =
@@ -623,6 +634,7 @@
     feature_count = 0;
     n_outside = 0;
     n_filtered = 0;
+    n_class_filtered = 0;
 
     Points = Vect_new_line_struct();
     Cats = Vect_new_cats_struct();
@@ -654,7 +666,7 @@
 	if (return_filter != LAS_ALL) {
 	    int return_no = LASPoint_GetReturnNumber(LAS_point);
 	    int n_returns = LASPoint_GetNumberOfReturns(LAS_point);
-	    int skipme = 1;
+	    skipme = 1;
 
 	    if (n_returns > 1) {
 
@@ -678,6 +690,22 @@
 		continue;
 	    }
 	}
+	if (class_opt->answer) {
+	    point_class = (int) LASPoint_GetClassification(LAS_point);
+	    i = 0;
+	    skipme = TRUE;
+	    while (class_opt->answers[i]) {
+		if (point_class == atoi(class_opt->answers[i])) {
+		    skipme = FALSE;
+		    break;
+		}
+		i++;
+	    }
+	    if (skipme) {
+		n_class_filtered++;
+		continue;
+	    }
+	}
 
 	Vect_append_point(Points, x, y, z);
 	Vect_cat_set(Cats, 1, cat);
@@ -782,13 +810,16 @@
 	Vect_build(&Map);
     Vect_close(&Map);
     
-    G_message(_("%d points imported"), n_features - not_valid - n_outside - n_filtered);
+    G_message(_("%d points imported"),
+              n_features - not_valid - n_outside - n_filtered - n_class_filtered);
     if (not_valid)
 	G_message(_("%d input points were not valid"), not_valid);
     if (n_outside)
 	G_message(_("%d input points were outside of the selected area"), n_outside);
     if (n_filtered)
 	G_message(_("%d input points were filtered by return number"), n_filtered);
+    if (n_class_filtered)
+        G_message(_("%d input points were filtered by class number"), n_class_filtered);
 
     /* -------------------------------------------------------------------- */
     /*      Extend current window based on dataset.                         */

Modified: grass/branches/releasebranch_7_0/vector/v.in.lidar/v.in.lidar.html
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.in.lidar/v.in.lidar.html	2014-09-13 21:46:04 UTC (rev 61918)
+++ grass/branches/releasebranch_7_0/vector/v.in.lidar/v.in.lidar.html	2014-09-13 21:49:50 UTC (rev 61919)
@@ -23,8 +23,13 @@
 used to obtain a digital surface model (DSM) where e.g. canopy cover is 
 represented. The last return values can be used to obtain a digital 
 terrain model (DTM) where e.g. the forest floor instead of canopy 
-cover is represented. The <b>filter</b> option allows to select one of 
+cover is represented. The <b>return_filter</b> option allows to select one of 
 first, mid, or last returns.
+<p>
+LiDAR points can be already classified into standardized classes. For example,
+class number 2 represents ground (for other classes see LAS format specification
+in references). The <b>class_filter</b> option allows to select one or more 
+classes, as numbers (integers) separated by comma.
 
 <h2>Location Creation</h2>
 
@@ -71,7 +76,7 @@
 
 <h2>REFERENCES</h2>
 
-<a href="http://www.asprs.org/a/society/committees/standards/lidar_exchange_format.html">
+<a href="http://www.asprs.org/Committee-General/LASer-LAS-File-Format-Exchange-Activities.html">
 ASPRS LAS format</a><br>
 <a href="http://www.liblas.org/">LAS library</a> <br>
 <a href="http://test.liblas.org/doxygen/liblas_8h.htm">LAS library C API</a> documentation



More information about the grass-commit mailing list