Changeset 66468


Ignore:
Timestamp:
Oct 10, 2015, 9:19:52 PM (9 years ago)
Author:
wenzeslaus
Message:

r.in.lidar: use base raster with its resolution

Computational region is used by default for input and output, when flag -d is enabled,
input follows base raster resolution (and also extent, this is suboptimal).

Adding also Bash test with small artificial data for different resolutions
in combination with base raster.

This commit follows r66094 and r66151.

Location:
grass/trunk/raster/r.in.lidar
Files:
5 added
1 edited

Legend:

Unmodified
Added
Removed
  • grass/trunk/raster/r.in.lidar/main.c

    r66380 r66468  
    153153    struct Option *trim_opt, *pth_opt, *res_opt;
    154154    struct Flag *print_flag, *scan_flag, *shell_style, *over_flag, *extents_flag, *intens_flag;
     155    struct Flag *base_rast_res_flag;
    155156
    156157    /* LAS */
     
    310311    intens_flag->description =
    311312        _("Import intensity values rather than z values");
     313
     314    base_rast_res_flag = G_define_flag();
     315    base_rast_res_flag->key = 'd';
     316    base_rast_res_flag->description =
     317        _("Use base raster actual resolution instead of computational region");
    312318
    313319    if (G_parser(argc, argv))
     
    661667     * region matches and using segment library when they don't */
    662668    int use_segment = 0;
    663     if (base_raster_opt->answer && res_opt->answer)
     669    int use_base_raster_res = 0;
     670    if (base_rast_res_flag->answer)
     671        use_base_raster_res = 1;
     672    if (base_raster_opt->answer && (res_opt->answer || use_base_raster_res))
    664673        use_segment = 1;
    665674    if (base_raster_opt->answer) {
     675        if (use_base_raster_res) {
     676            /* TODO: how to get cellhd already stored in the open map? */
     677            Rast_get_cellhd(base_raster_opt->answer, "", &input_region);
     678            /* TODO: make it only as small as the output is or points are */
     679            Rast_set_input_window(&input_region);  /* we have split window */
     680        }
    666681        /* TODO: do we need to test existence first? mapset? */
    667682        base_raster = Rast_open_old(base_raster_opt->answer, "");
     
    669684    }
    670685    if (base_raster_opt->answer && use_segment) {
    671         Rast_get_input_window(&input_region);  /* we have split window */
     686        if (!use_base_raster_res)
     687            Rast_get_input_window(&input_region);  /* we have split window */
    672688        /* TODO: these numbers does not fit with what we promise about percentage */
    673689        int segment_rows = 64;
     
    916932            else if (use_segment) {
    917933                double base_z;
     934                /* Rast gives double, Segment needs off_t */
    918935                off_t base_row = Rast_northing_to_row(y, &input_region);
    919936                off_t base_col = Rast_easting_to_col(x, &input_region);
Note: See TracChangeset for help on using the changeset viewer.