Skip to content

Scripts to process .las files and export the vegetation data into a 3dtiles convertible format

License

Notifications You must be signed in to change notification settings

VCityTeam/UD-VCity-Vegetation-LasToMesh

Repository files navigation

Vegetation

Presentation

The goal of this project is to use open datas (for example the LIDAR done for the city of Lyon) to extract information about the vegetation and transform it into multiple meshes that are easily convertible into 3DTiles for an easy visualization in apps like UD-Viz.

In order for the script to work, you'll need a classified and colored point cloud in the laz/las format. The LIDAR done for the city of Lyon is a good example of data to work with. A 'cell size' parameter is requiered to split the point cloud into sub-clouds of close enough vegetation.

The algorithm used to create the mesh vary based on the size of the sub-cloud provided :

  • For tiny clouds : we use the convex hull algorithm
  • For really large clouds : we use the alpha shape algorithm on a flatenned cloud (2D) and then extrude the result
  • For the other clouds : we use the alpha shape algorithm. The alpha parameter is determined by the size of the cloud

Technology

We're using Python scripts to process the point clouds.
The version the script was developped for is Python 3.9, any other version is not guaranteed to work.
We're using some libraries such as laspy, Open3D and Alpha Shape Toolbox

Install

For Windows :

git clone https://github.com/VCityTeam/UD-VCity-Vegetation-LasToMesh.git
cd UD-VCity-Vegetation-LasToMesh

python3.9 -m venv venv
. venv/Scripts/activate
pip install -r requirements.txt 

Datas

The input for this program is a classified, colored, las/laz file. The vegetation needs to be classified on at least one of the 3 standard values (3, 4 or 5). The color needs to be in the standard las RGB channel.

Small sample datas are included but you can download large scale datas here.

Parameters

Command Description Default value Example
-i / --input Mandatory The input las/laz file. For the moment only a single file can be treated at a time. None (mandatory) -i ./SampleDatas/ExampleDataIsolatedTrees.las
-o / --output The output folder. Created if non existing.
⚠️ The content of the folder will be deleted if not empty !
./output/ -o ./outputFolder/
-c / --cellsize The size each cell must take inside the grid. The grid is used to split the point cloud into sub-clouds of near vegetation. 2.0 -c 1.5
-v / --verbose Increase the output verbosity. None -v

Usage

Refer to the 'Install' section for the installation commands.
Download datas, for example here.

For the following command, we're assuming you downloaded a file nammed ExampleData.las and that it is located in the same folder as the script.

# if not already in venv
. venv/Scripts/activate

python mainCLI.py -i ExampleData.las -o .\outputFolder\ -c 2.0

Notes :

  • The messages 'Singular matrix. Likely caused by all points lying in an N-1 space.' might pop up, the script will still work normally
  • The output folder does not need to exist beforehand, but if it does, all existing files will be wiped out. So be careful. It is therefore not advised to use .\ as an argument ;)

What you'll get is a folder filled with obj files. You can then use 3D-model viewer to visualize your results or else use py3dtilers and more specifically the obj-tiler to transform the meshes into 3D tiles.
Finally, consider using UD-Viz to view the 3D-tiles inside a web app.

Docker

This repository is dockerized within this other repository

About

Scripts to process .las files and export the vegetation data into a 3dtiles convertible format

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages