Explorar o código

v.in.pdal: remove obsolete PCL functionality (#1907)

v.in.pdal: remove obsolete PCL functionality
Māris Nartišs %!s(int64=3) %!d(string=hai) anos
pai
achega
7b20e6017d
Modificáronse 3 ficheiros con 6 adicións e 149 borrados
  1. 3 0
      gui/wxpython/xml/toolboxes.xml
  2. 0 133
      vector/v.in.pdal/main.cpp
  3. 3 16
      vector/v.in.pdal/v.in.pdal.html

+ 3 - 0
gui/wxpython/xml/toolboxes.xml

@@ -348,6 +348,9 @@
       <module-item name="v.in.lidar">
         <label>LAS LiDAR points import</label>
       </module-item>
+      <module-item name="v.in.pdal">
+        <label>Point cloud (LAS LiDAR) import</label>
+      </module-item>
       <separator/>
       <module-item name="v.unpack">
         <label>Unpack vector map</label>

+ 0 - 133
vector/v.in.pdal/main.cpp

@@ -234,50 +234,6 @@ int main(int argc, char *argv[])
               " or WKT definition");
     input_srs_opt->guisection = _("Projection");
 
-    Option *max_ground_window_opt = G_define_option();
-    max_ground_window_opt->key = "max_ground_window_size";
-    max_ground_window_opt->type = TYPE_DOUBLE;
-    max_ground_window_opt->required = NO;
-    max_ground_window_opt->answer = G_store("33");
-    max_ground_window_opt->description =
-        _("Maximum window size for ground filter");
-    max_ground_window_opt->guisection = _("Ground filter");
-
-    Option *ground_slope_opt = G_define_option();
-    ground_slope_opt->key = "ground_slope";
-    ground_slope_opt->type = TYPE_DOUBLE;
-    ground_slope_opt->required = NO;
-    ground_slope_opt->answer = G_store("1.0");
-    ground_slope_opt->description = _("Slope for ground filter");
-    ground_slope_opt->guisection = _("Ground filter");
-
-    Option *max_ground_distance_opt = G_define_option();
-    max_ground_distance_opt->key = "max_ground_distance";
-    max_ground_distance_opt->type = TYPE_DOUBLE;
-    max_ground_distance_opt->required = NO;
-    max_ground_distance_opt->answer = G_store("2.5");
-    max_ground_distance_opt->description =
-        _("Maximum distance for ground filter");
-    max_ground_distance_opt->guisection = _("Ground filter");
-
-    Option *init_ground_distance_opt = G_define_option();
-    init_ground_distance_opt->key = "initial_ground_distance";
-    init_ground_distance_opt->type = TYPE_DOUBLE;
-    init_ground_distance_opt->required = NO;
-    init_ground_distance_opt->answer = G_store("0.15");
-    init_ground_distance_opt->description =
-        _("Initial distance for ground filter");
-    init_ground_distance_opt->guisection = _("Ground filter");
-
-    Option *ground_cell_size_opt = G_define_option();
-    ground_cell_size_opt->key = "ground_cell_size";
-    ground_cell_size_opt->type = TYPE_DOUBLE;
-    ground_cell_size_opt->required = NO;
-    ground_cell_size_opt->answer = G_store("1");
-    ground_cell_size_opt->description =
-        _("Initial distance for ground filter");
-    ground_cell_size_opt->guisection = _("Ground filter");
-
     Flag *nocats_flag = G_define_flag();
     nocats_flag->key = 'c';
     nocats_flag->label =
@@ -292,41 +248,8 @@ int main(int argc, char *argv[])
     region_flag->guisection = _("Selection");
     region_flag->description = _("Limit import to the current region");
 
-    Flag *extract_ground_flag = G_define_flag();
-    extract_ground_flag->key = 'j';
-    extract_ground_flag->label =
-        _("Classify and extract ground points");
-    extract_ground_flag->description =
-        _("This assignes class 2 to the groud points");
-    extract_ground_flag->guisection = _("Ground filter");
-
-    // TODO: by inverting class filter and choosing 2 we can select non-groud points
-    // this can be done as a separate flag (generally useful?)
-    // or this flag can be changed (only ground is classified anyway)
-    // and it would Classify ground and extract non-ground
-    // probably better if only one step is required to get ground and non-ground
-    Flag *classify_ground_flag = G_define_flag();
-    classify_ground_flag->key = 'k';
-    classify_ground_flag->description = _("Classify ground points");
-    classify_ground_flag->guisection = _("Ground filter");
-
-    Flag *height_filter_flag = G_define_flag();
-    height_filter_flag->key = 'h';
-    height_filter_flag->label =
-        _("Compute height for points as a difference from ground");
-    height_filter_flag->description =
-        _("This requires points to have class 2");
-    height_filter_flag->guisection = _("Transform");
-
-    Flag *approx_ground_flag = G_define_flag();
-    approx_ground_flag->key = 'm';
-    approx_ground_flag->description =
-        _("Use approximate algorithm in ground filter");
-    approx_ground_flag->guisection = _("Ground filter");
-
     G_option_exclusive(spatial_opt, region_flag, NULL);
     G_option_exclusive(reproject_flag, over_flag, NULL);
-    G_option_exclusive(extract_ground_flag, classify_ground_flag, NULL);
     G_option_exclusive(nocats_flag, id_layer_opt, NULL);
     G_option_requires(return_layer_opt, id_layer_opt, nocats_flag, NULL);
     G_option_requires(class_layer_opt, id_layer_opt, nocats_flag, NULL);
@@ -435,53 +358,6 @@ int main(int argc, char *argv[])
         last_stage = &reprojection_filter;
     }
 
-    if (extract_ground_flag->answer || classify_ground_flag->answer) {
-        if (extract_ground_flag->answer)
-            G_message(_("Extracting ground points"));
-        if (classify_ground_flag->answer)
-            G_message(_("Classifying ground points"));
-        pdal::Options groundOptions;
-        groundOptions.add<double>("max_window_size",
-                                  atof(max_ground_window_opt->answer));
-        groundOptions.add<double>("slope",
-                                  atof(ground_slope_opt->answer));
-        groundOptions.add<double>("max_distance",
-                                  atof(max_ground_distance_opt->answer));
-        groundOptions.add<double>("initial_distance",
-                                  atof(init_ground_distance_opt->answer));
-        groundOptions.add<double>("cell_size",
-                                  atof(ground_cell_size_opt->answer));
-        groundOptions.add<bool>("classify",
-                                classify_ground_flag->answer);
-        groundOptions.add<bool>("extract",
-                                extract_ground_flag->answer);
-        groundOptions.add<bool>("approximate",
-                                approx_ground_flag->answer);
-        groundOptions.add<bool>("debug", false);
-        groundOptions.add<uint32_t>("verbose", 0);
-
-        // TODO: free this or change pointer type to shared
-        pdal::Stage * ground_stage(factory.createStage("filters.ground"));
-        if (!ground_stage)
-            G_fatal_error(_("Ground filter is not available"
-                            " (PDAL probably compiled without PCL)"));
-        ground_stage->setOptions(groundOptions);
-        ground_stage->setInput(*last_stage);
-        last_stage = ground_stage;
-    }
-
-    if (height_filter_flag->answer) {
-        // TODO: we should test with if (point_layout->hasDim(Id::Classification))
-        // but we don't have the info yet
-        // TODO: free this or change pointer type to shared
-        pdal::Stage * height_stage(factory.createStage("filters.height"));
-        if (!height_stage)
-            G_fatal_error(_("Height above ground filter is not available"
-                            " (PDAL probably compiled without PCL)"));
-        height_stage->setInput(*last_stage);
-        last_stage = height_stage;
-    }
-
     pdal::StreamCallbackFilter stream_filter;
     stream_filter.setInput(*last_stage);
     // there is no difference between 1 and 10k points in memory
@@ -563,15 +439,6 @@ int main(int argc, char *argv[])
         G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
     Vect_hist_command(&output_vector);
 
-    // height is stored as a new attribute
-    if (height_filter_flag->answer) {
-        // TODO: This needs to be reviewed on Height vs Elevation
-        dim_to_use_as_z = point_layout->findDim("Height");
-        if (dim_to_use_as_z == pdal::Dimension::Id::Unknown)
-            G_fatal_error(_("Cannot identify the height dimension"
-                            " (probably something changed in PDAL)"));
-    }
-
     // this is just for sure, we test the individual dimensions before
     // TODO: should we test Z explicitly as well?
     if (!point_layout->hasDim(dim_to_use_as_z))

+ 3 - 16
vector/v.in.pdal/v.in.pdal.html

@@ -1,15 +1,8 @@
 <h2>DESCRIPTION</h2>
 
-<em>v.in.pdal</em> supports the following PDAL filters:
+<p>Imports a point cloud (e.g. from a LAS file) as vector points with the PDAL library.
 
-<ul>
-<li>groud detection with Point Cloud Library (PCL) Progressive Morphological Filter (Zhang 2003)
-    (<a href="http://www.pdal.io/stages/filters.ground.html">filters.ground</a>)
-<li><a href="http://www.pdal.io/stages/filters.height.html">filters.height</a>
-    (requires PCL)
-</ul>
-
-<em>v.in.pdal</em> supports the following filters natively:
+<em>v.in.pdal</em> supports the following filters:
 
 <ul>
 <li>2D region filter
@@ -30,8 +23,7 @@ v.in.pdal input=points.las output=points -c -r -w
 <h2>SEE ALSO</h2>
 
 <em>
-<a href="r.in.lidar.html">r.in.lidar</a>,
-<a href="r3.in.lidar.html">r3.in.lidar</a>,
+<a href="r.in.pdal.html">r.in.pdal</a>,
 <a href="g.region.html">g.region</a>,
 <a href="v.vect.stats.html">v.vect.stats</a>
 <a href="v.in.ogr.html">v.in.ogr</a>,
@@ -46,11 +38,6 @@ v.in.pdal input=points.las output=points -c -r -w
     XXIII ISPRS Congress 2016
     [<a href="http://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLI-B7/945/2016/">ISPRS Archives</a>,
     <a href="https://www.researchgate.net/publication/304340172_Processing_UAV_and_lidar_point_clouds_in_GRASS_GIS">ResearchGate</a>]
-<li>Zhang, Keqi, et al.
-    <em>A progressive morphological filter for removing nonground
-    measurements from airborne LIDAR data.</em>
-    Geoscience and Remote Sensing,
-    IEEE Transactions on 41.4 (2003): 872-882.
 </ul>
 
 <h2>AUTHOR</h2>