Quick recipe

Adriaan van Natijne, October 2017.

Presented here is a abbriviated version of the manual presented in my Additional Thesis. Focus of this manual is to create a simple PoTree web-interface from a pointcloud and add radar measurements to it. This is not the full flowchart as discussed in the report. In this recipe a simple case of a single pointcloud and a small (less than 1500 points) radar file is discussed.

Prerequisites

Pointcloud

Using PoTreeConverter the input LAS-file is converted into an octree of binary files. For AHN3 tile 37EN1 the command will be as follows:

PotreeConverter C_37EN1.laz \
-o ./web --material INTENSITY -p AHN3 --show-skybox \
--projection "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs" \
--edl-enabled --intensity-range 3 256 -r 256 \
-a CLASSIFICATION INTENSITY

Some explanation on the parameters:

  1. C_37EN1.laz, the input file or files.
  2. -o ./web, the output directory.
  3. --material INTENSITY, the attribute on display. All attributes mentioned under -a are stored, and may be selected for display in the viewer.
    Supported are: RGB, ELEVATION, INTENSITY, INTENSITY_GRADIENT, RETURN_NUMBER, SOURCE and LEVEL_OF_DETAIL. If the material is RGB, INTENSITY or CLASSIFICATION it should be mentioned under -a too!
  4. -p AHN3, the filename in the output directory (-o).
  5. --show-skybox, show some clouds as background (optional).
  6. --projection "...", projection (EPSG:28992), ignored by PoTreeConvert but used by PoTree for addding a map.
  7. --edl-enabled, enable %quot;Eye-Dome-Lighting%quot; for a more natural looking pointcloud.
  8. --intensity-range 3 256 -r 256, although a full intensity range up to 65536 is available, with AHN3 most points have an intensity value between 3 and 256. Without those limits the pointcloud will be all black.
  9. -a CLASSIFICATION INTENSITY, attributes to include in the output.
    Supported are: RGB, INTENSITY and CLASSIFICATION

After running PoTreeConverter there should be a file web/AHN3.html. When opened in a browser (even locally) this should give a working PoTree installation.

Radar ellipsoids

Next step is adding the radar (error) ellipsoids. Independent of the source of the data JSON is the prefered format to feed the data to the viewer. In this recipe an extra simplified format is used. It may be extended at will.

As of Matlab 2016b jsonencode() is available. Other languages will have similar functions. The input does not matter as long as the output is of the same structure.

In this example the structure is a list of series of x, y, z values (as shown below) in the same coordinate system as the pointcloud. Whitespace is unimportant. The file should be saved as web/radar.json.

[{"x":85443.4,"y":446144.6,"z":-1.714},{"x":85452.0,"y":446150.5,"z":-1.346},{"x":85450.1,"y":446138.7,"z":-0.73},{"x":85437.0,"y":446151.9,"z":-0.7},{"x":85440.7,"y":446157.1,"z":-0.158},{"x":85434.1,"y":446142.3,"z":-0.569},{"x":85453.7,"y":446133.0,"z":-1.341},{"x":85458.1,"y":446135.6,"z":-1.543},{"x":85433.7,"y":446159.2,"z":-1.077},{"x":85435.6,"y":446161.7,"z":-0.8}]

To add the ellipsoids, add the following lines to web/AHN3.html, before </script> at around line 72. The current parameters (scaling, rotation) are based on the TerraSAR-X estimates. See the comments for some guidance.

// Read the file
$.getJSON('./radar.json', function(data) {
    // Create a spehere with radius 1
    let sph = new THREE.SphereGeometry(1, 12, 10);

    // Create a material
    let sphm = new THREE.MeshNormalMaterial();

    // Create a rotation matrix
    var eul = new THREE.Euler(0, -1.150172, -1.605703);

    // Loop over all elements
    $.each(data, function(key, val) {
        // Create an element out of the sphere and the material
        let s = new THREE.Mesh(sph, sphm);

        // Scale the ellipsoid
        s.scale.set(0.075, 0.025, 5.00);

        // Rotate the ellipsoid
        s.rotation.copy(eul);

        // Position the ellipsoid
        s.position.set(val.x, val.y, val.z);

        // Calculate the transformation matrix ...
        s.updateMatrix();
        s.matrixAutoUpdate = false; // ... only once, to improve performence

        // Add to the viewer (scene)
        viewer.scene.scene.add(s);
    });
});
        

You should now see ellipsoids in your 3D world (hint: on the pavement, they are small)!


Index - Last edited: 2017-10-26 16:30 CEST