PermafrostDiscoveryGateway / viz-points

Python package for post-processing point-cloud data for 3D visualization
Apache License 2.0
0 stars 1 forks source link

viz-points

Python package for post-processing point-cloud data for 3D visualization

Repository contents

Installation

Hardware requirements

This software requires an x86_64 architecture and a Linux environment.

Software requirements

Visualization requirements:

Unix installation example

Remember to set up and activate your virtual environment before proceeding.

# use conda to set up environment
conda create -n viz-points python=3.9
conda activate viz-points
conda install -c conda-forge pdal
# get and install this software
git clone https://github.com/PermafrostDiscoveryGateway/viz-points.git
cd viz-points
# checkout the development branch if necessary
git checkout develop
pip install .
# test your installation
tilepoints-test

Usage

This software is designed to be used either as a command line tool or as a Python package.

Command line usage

Command syntax:

tilepoints [ OPTIONS ] -f /path/to/file.las

Required argument:

    -f file.las | --file=/path/to/file.las
            specify the path to a LAS or LAZ point cloud file

Options:

    -h | --help
            display the help message
    -v | --verbose
            display more informational messages
    -c | --copy_I_to_RGB
            copy intensity values to RGB channels
    -m | --merge
            merge all tilesets in the output folder (./3dtiles)
    -a | --archive
            copy original LAS files to a ./archive folder
    -s X | --rgb_scale=X
            scale RGB values by X amount
    -z X | --translate_z=X
            translate Z (elevation) values by X amount

Python usage

Python example:

from pdgpoints.pipeline import Pipeline

p = Pipeline(f='/path/to/file.laz',
             intensity_to_RGB=True,
             merge=True,
             archive=False,
             rgb_scale=4.0,
             translate_z=-8.3,
             verbose=False)
p.run()

Visualizing the data in Cesium

You can view the output tiles in a Cesium environment. For steps for how to visualize the tiles with a local Cesium instance, see the documentation here in pdg-info.

Test dataset

More info on the above test dataset here.

Below is an example of the cesium.js file that will display a 3dtiles tileset at ./3dtiles/tileset.json (you will need your own access token):


function start(){// Your access token can be found at: https://cesium.com/ion/tokens.

  Cesium.Ion.defaultAccessToken = "YOUR-TOKEN-HERE"

  const viewer = new Cesium.Viewer('cesiumContainer');

  const imageryLayers = viewer.imageryLayers;

  var tileset = new Cesium.Cesium3DTileset({
    url: "3dtiles/tileset.json",
    debugShowBoundingVolume: true,
    debugShowContentBoundingVolume: false,
    debugShowGeometricError: false,
    debugWireframe: true
  });

  viewer.scene.primitives.add(tileset);

  window.zoom_to_me = function(){
    viewer.zoomTo(tileset);
  }

  tileset.readyPromise.then(zoom_to_me).otherwise(error => { console.log(error) });
}

start()

Referencing this repository

If you would like to cite this repository, we suggest using something like the following:

Ian M. Nesbitt, Robyn Thiessen-Bock, and Matthew B. Jones (NCEAS). viz-points: A Python package for post-processing point-cloud data for 3D visualization. https://github.com/PermafrostDiscoveryGateway/viz-points.