Skip to content

48 lidar

image image image

Visualizing LiDAR data in 3D with only one line of code

Uncomment the following line to install leafmap if needed.

1
# !pip install leafmap
1
# !pip install leafmap[lidar] open3d
1
2
import os
import leafmap

Download a sample LiDAR dataset from Google Drive. The zip file is 52.1 MB and the uncompressed LAS file is 109 MB.

1
2
url = "https://opengeos.org/data/lidar/madison.zip"
filename = "madison.las"
1
leafmap.download_file(url, "madison.zip", unzip=True)

Read the LiDAR data

1
las = leafmap.read_lidar(filename)

The LAS header.

1
las.header

The number of points.

1
las.header.point_count

The list of features.

1
list(las.point_format.dimension_names)

Inspect data.

1
las.X
1
las.Y
1
las.Z
1
las.intensity

Visualize LiDAR data using the pyvista backend.

1
leafmap.view_lidar(filename, cmap="terrain", backend="pyvista")

Visualize LiDAR data using the ipygany backend.

1
leafmap.view_lidar(filename, backend="ipygany", background="white")

Visualize LiDAR data using the panel backend.

1
leafmap.view_lidar(filename, cmap="terrain", backend="panel", background="white")

Visualize LiDAR data using the open3d backend.

1
leafmap.view_lidar(filename, backend="open3d")