The dataset used in this example notebook is from the Nakadake Sanroku Kiln Site Center in Japan. The data set is provided by Shinoto et al. under the CC-BY-4.0 license: DOI

Mapping segmentations to filter pipelines

When talking about adaptive ground point filtering in AFwizard we have two types of adaptivity in mind: Parameter adaptivity and spatial adaptivity. This notebook describes the details of how spatial adaptivity is implemented in AFwizard. It assumes that you have already created a suitable segmentation of your dataset into spatial features (e.g. in a GIS). We will then see how we can attach filter pipeline information to that segmentation file.

[1]:
import afwizard

We again work on our demonstrator dataset:

[2]:
ds = afwizard.DataSet(filename="nkd_pcl_epsg6670.laz", spatial_reference="EPSG:6670")

Next, we import the segmentation the GeoJSON file. It is assumed to contain a FeatureCollection in the sense of the GeoJSON standard where each features combines the geometric information of the segment (Polygon or Multipolygon) and a number of properties. One of these properties should contain your custom classification of the segments into classes.

[3]:
segmentation = afwizard.load_segmentation(
    "nkd_sgm_assigned_TF.geojson", spatial_reference="EPSG:6670"
)

As we are trying to map features to filter pipelines, we also need to load some filter pipelines. Here, we are directly opening these using load_filter. In practice, these should be selected from available filter libraries using e.g. the tools described in Working with filter libraries.

[4]:
pipelines = [
    afwizard.load_filter("nkd_fpl_paddy_LT.json"),
    afwizard.load_filter("nkd_fpl_slope_LT.json"),
    afwizard.load_filter("nkd_fpl_valley_TF.json"),
]

The core task of assigning filter piplines is done by the assign_pipeline function which allows us to interactively set filter pipelines. On the right hand side, we can choose which property of our GeoJSON file contains the classification information. A feature can be highlighted on the map by clicking the button. For each class of segments, a pipeline can be selected from the dropdown menu:

[5]:
assigned_segmentation = afwizard.assign_pipeline(
    ds, segmentation=segmentation, pipelines=pipelines
)

Once the pipelines are assigned, the returned segmentation object has a new property called “pipeline” that will direct the adaptivefiltering command line interface to the corresponding filter pipeline file. The modified file can be saved to disk by using the save method:

[6]:
assigned_segmentation.save("assigned_segmentation.geojson")

It is worth noting that afwizard does not store the entire filter configuration in the GeoJSON object. This is done to allow further refinement of the used filter pipelines after the segmentation is created. Also, it does not store absolute or relative paths to your filter pipelines, because these could always change when moving to new hardware or when reorganizing your project. Instead it stores the metadata of your filter (in hashed form) and compares it against the metadata of the filter pipelines in your currently loaded filter libraries. If metadata is ambiguous across the given filter libraries, an error will be thrown.

[ ]: