Skip to content

Commit

Permalink
Merge pull request #12 from PermafrostDiscoveryGateway/develop
Browse files Browse the repository at this point in the history
Release 0.0.2 of LiDAR tiling workflow
  • Loading branch information
iannesbitt authored Mar 20, 2024
2 parents b173488 + 8771108 commit 52c0e2c
Show file tree
Hide file tree
Showing 29 changed files with 3,593 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Test artifacts
pdgpoints/testdata/lp_jumps.laz
pdgpoints/testdata/tileset.json
pdgpoints/testdata/*[.txt|.zip]
pdgpoints/testdata/*/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include pdgpoints/bin/*
include pdgpoints/testdata/*
include pdgpoints/log/*
139 changes: 138 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,139 @@
# viz-points
Pythonpackage for post-processing point-cloud data for 3D visualization
Python package for post-processing point-cloud data for 3D visualization

## Repository contents

- [notebooks/](notebooks/) contains the simplified and annotated Jupyter Notebook version of the LiDAR processing workflow
- [pdgpoints/](pdgpoints/) contains the application code comprising the library

## Installation

### Hardware requirements
This software requires an x86_64 architecture and a Linux environment.

### Software requirements
- [pdal](https://github.com/PDAL/python) (pip installation may not build...if so use [anaconda](https://anaconda.org/) or [miniconda](https://repo.anaconda.com/miniconda/))
- [py3dtiles](https://gitlab.com/oslandia/py3dtiles) (Oslandia versions after [522ce61a](https://gitlab.com/Oslandia/py3dtiles/-/blob/522ce61a0c2cbeb496ba4862e14477bb941b23a3/py3dtiles/merger.py))
- rapidlasso [las2las](https://rapidlasso.com/lastools/las2las/) and [lasinfo](https://rapidlasso.com/lastools/lasinfo/) post-November 2022 (rapidlasso [precompiled Windows](https://github.com/LAStools/LAStools/blob/master/README.md#links) or included [linux binary](https://rapidlasso.de/release-of-lastoolslinux/))

Visualization requirements:
- A tool that can display 3dtiles data, such as [Cesium](https://cesium.com)

### Unix installation example

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

```bash
# 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:**
```python
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](https://github.com/julietcohen/pdg-info/blob/main/05_displaying-the-tiles.md#option-1-run-cesium-locally).

![Test dataset](pdgpoints/testdata/lp.png)

More info on the above test dataset [here](pdgpoints/testdata/README.md).

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):


```javascript

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.
```
23 changes: 23 additions & 0 deletions docsrc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

github:
@make html
@cp -a _build/html/. ../docs

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
208 changes: 208 additions & 0 deletions docsrc/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
# sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../'))
from datetime import datetime


# -- Project information -----------------------------------------------------

project = 'viz-points'
copyright = '%s, National Center for Ecological Analysis and Synthesis, University of California Santa Barbara (NCEAS-UCSB)' % datetime.now().year
author = 'Ian Nesbitt'

# The short X.Y version
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from pdgpoints._version import __version__ as version
# The full version, including alpha/beta/rc tags
release = version


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.autosectionlabel',
'sphinx.ext.githubpages',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The name of the Pygments (syntax highlighting) style to use.
#pygments_style = None
pygments_style = 'sphinx'


# autosummary
#autosummary_generate = True

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_logo = '_static/logo.png'

#html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'vizpointsdoc'


# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'vizpoints.tex', project+' Documentation',
author, 'manual'),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, project, project+' Documentation',
[author], 1)
]


# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, project, project+' Documentation',
author, project, 'Convert lidar data (LAZ, LAS, etc.) to 3dtiles',
'Miscellaneous'),
]


# -- Options for Epub output -------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = project

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''

# A unique identification for the text.
#
# epub_uid = ''

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']


# -- Extension configuration -------------------------------------------------

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python 3': ('https://docs.python.org/3', None),
'pyproj [stable]': ('https://pyproj4.github.io/pyproj/stable', None),
'pyegt [stable]': ('https://iannesbitt.github.io/pyegt', None),
}

# -- Options for todo extension ----------------------------------------------

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
Empty file added notebooks/README.md
Empty file.
Loading

0 comments on commit 52c0e2c

Please sign in to comment.