Changeset 60247 for grass/trunk/raster/r.in.lidar
- Timestamp:
- May 15, 2014, 3:21:58 AM (10 years ago)
- Location:
- grass/trunk/raster/r.in.lidar
- Files:
-
- 2 edited
-
main.c (modified) (9 diffs)
-
r.in.lidar.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
grass/trunk/raster/r.in.lidar/main.c
r57951 r60247 27 27 #include <grass/gprojects.h> 28 28 #include <grass/glocale.h> 29 #include <liblas/capi/liblas.h> 29 30 #include "local_proto.h" 30 31 … … 40 41 struct node *nodes; 41 42 43 #define LAS_ALL 0 44 #define LAS_FIRST 1 45 #define LAS_LAST 2 46 #define LAS_MID 3 42 47 43 48 int new_node(void) … … 139 144 140 145 struct GModule *module; 141 struct Option *input_opt, *output_opt, *percent_opt, *type_opt ;146 struct Option *input_opt, *output_opt, *percent_opt, *type_opt, *filter_opt; 142 147 struct Option *method_opt, *zrange_opt, *zscale_opt; 143 148 struct Option *trim_opt, *pth_opt, *res_opt; … … 149 154 LASSRSH LAS_srs; 150 155 LASPointH LAS_point; 156 int return_filter; 151 157 152 158 struct Key_Value *loc_proj_info = NULL, *loc_proj_units = NULL; … … 155 161 struct Cell_head cellhd, loc_wind; 156 162 163 unsigned int n_filtered; 157 164 158 165 G_gisinit(argv[0]); … … 237 244 _("Output raster resolution"); 238 245 246 filter_opt = G_define_option(); 247 filter_opt->key = "filter"; 248 filter_opt->type = TYPE_STRING; 249 filter_opt->required = NO; 250 filter_opt->label = _("Only import points of selected return type"); 251 filter_opt->description = _("If not specified, all points are imported"); 252 filter_opt->options = "first,last,mid"; 253 239 254 print_flag = G_define_flag(); 240 255 print_flag->key = 'p'; … … 303 318 304 319 exit(EXIT_SUCCESS); 320 } 321 322 return_filter = LAS_ALL; 323 if (filter_opt->answer) { 324 if (strcmp(filter_opt->answer, "first") == 0) 325 return_filter = LAS_FIRST; 326 else if (strcmp(filter_opt->answer, "last") == 0) 327 return_filter = LAS_LAST; 328 else if (strcmp(filter_opt->answer, "mid") == 0) 329 return_filter = LAS_MID; 330 else 331 G_fatal_error(_("Unknown filter option <%s>"), filter_opt->answer); 305 332 } 306 333 … … 322 349 /* Does the projection of the current location match the dataset? */ 323 350 /* G_get_window seems to be unreliable if the location has been changed */ 324 G_get_set_window(&loc_wind); 351 G_get_set_window(&loc_wind); /* TODO: v.in.lidar uses G_get_default_window() */ 325 352 /* fetch LOCATION PROJ info */ 326 353 if (loc_wind.proj != PROJECTION_XY) { … … 736 763 y = LASPoint_GetY(LAS_point); 737 764 z = LASPoint_GetZ(LAS_point); 765 766 if (return_filter != LAS_ALL) { 767 int return_no = LASPoint_GetReturnNumber(LAS_point); 768 int n_returns = LASPoint_GetNumberOfReturns(LAS_point); 769 int skipme = 1; 770 771 if (n_returns > 1) { 772 773 switch (return_filter) { 774 case LAS_FIRST: 775 if (return_no == 1) 776 skipme = 0; 777 break; 778 case LAS_LAST: 779 if (return_no == n_returns) 780 skipme = 0; 781 break; 782 case LAS_MID: 783 if (return_no > 1 && return_no < n_returns) 784 skipme = 0; 785 break; 786 } 787 } 788 if (skipme) { 789 n_filtered++; 790 continue; 791 } 792 } 738 793 739 794 if (y <= pass_south || y > pass_north) { -
grass/trunk/raster/r.in.lidar/r.in.lidar.html
r57949 r60247 85 85 <!-- explained: memory use for regular stats will be based solely on region size, 86 86 but for the aggregate fns it will also depend on the number of data points. (?) --> 87 87 <p> 88 A LiDAR pulse can have multiple returns. The first return values can be 89 used to obtain a digital surface model (DSM) where e.g. canopy cover is 90 represented. The last return values can be used to obtain a digital 91 terrain model (DTM) where e.g. the forest floor instead of canopy 92 cover is represented. The <b>filter</b> option allows to select one of 93 first, mid, or last returns. 88 94 <p> 89 95 The default map <b>type</b>=<tt>FCELL</tt> is intended as compromise between
Note:
See TracChangeset
for help on using the changeset viewer.
