{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/gee-community/geemap/blob/master/examples/notebooks/101_lidar.ipynb)\n", "[![image](https://mybinder.org/badge_logo.svg)](https://gishub.org/geemap-binder)\n", "\n", "**Visualizing LiDAR data in 3D with only one line of code**\n", "\n", "Uncomment the following line to install [geemap](https://geemap.org) if needed." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# !pip install geemap[lidar] open3d" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "import geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Download a [sample LiDAR dataset](https://drive.google.com/file/d/1H_X1190vL63BoFYa_cVBDxtIa8rG-Usb/view?usp=sharing) from Google Drive. The zip file is 52.1 MB and the uncompressed LAS file is 109 MB." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "url = (\n", " 'https://drive.google.com/file/d/1H_X1190vL63BoFYa_cVBDxtIa8rG-Usb/view?usp=sharing'\n", ")\n", "filename = 'madison.las'" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "if not os.path.exists(filename):\n", " geemap.download_file(url, 'madison.zip', unzip=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Read the LiDAR data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "las = geemap.read_lidar(filename)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The LAS header." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "las.header" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The number of points." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "las.header.point_count" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The list of features." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "list(las.point_format.dimension_names)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Inspect data." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "las.X" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "las.Y" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "las.Z" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "las.intensity" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Visualize LiDAR data using the [pyvista](https://github.com/pyvista/pyvista) backend." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# geemap.view_lidar(filename, cmap='terrain', backend='pyvista')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](https://i.imgur.com/xezcgMP.gif)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Visualize LiDAR data using the [ipygany](https://github.com/QuantStack/ipygany) backend." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# geemap.view_lidar(filename, backend='ipygany', background='white')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](https://i.imgur.com/MyMWW4I.gif)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Visualize LiDAR data using the [panel](https://github.com/holoviz/panel) backend." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# geemap.view_lidar(filename, cmap='terrain', backend='panel', background='white')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](https://i.imgur.com/XQGWbJk.gif)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Visualize LiDAR data using the [open3d](http://www.open3d.org) backend." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# geemap.view_lidar(filename, backend='open3d')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](https://i.imgur.com/rL85fbl.gif)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }