Skip to content

Commit

Permalink
Add data visualization notebook examples
Browse files Browse the repository at this point in the history
* Add data visualization notebook examples

* Update lidar notebook

* Update raster viz notebook

* Delete markdown files

* Update lidar notebook

* Add vector viz notebook

* Fix typo

* Update README
  • Loading branch information
giswqs authored Nov 21, 2023
1 parent 202cc64 commit 109d5a8
Show file tree
Hide file tree
Showing 8 changed files with 1,419 additions and 14 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ jobs:
- name: Build docs
run: |
mkdocs build
# - name: Deploy to Netlify
# uses: nwtgck/actions-netlify@v2.0
# with:
# publish-dir: "./site"
# production-branch: master
# github-token: ${{ secrets.GITHUB_TOKEN }}
# deploy-message: "Deploy from GitHub Actions"
# enable-pull-request-comment: true
# enable-commit-comment: false
# overwrites-pull-request-comment: true
# env:
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# timeout-minutes: 10
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v2.0
with:
publish-dir: "./site"
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: true
enable-commit-comment: false
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 10
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ private/

# C extensions
*.so
**/*.tif
**/*.zip
**/*.las

# Distribution / packaging
.Python
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@

## Features

- Visualizing geospatial data, including vector, raster, and LiDAR data
- Segmenting remote sensing imagery with the Segment Anything Model
- Classifying remote sensing imagery with deep learning models
321 changes: 321 additions & 0 deletions docs/examples/dataviz/lidar_viz.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,321 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[![image](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/opengeos/geoai/blob/main/examples/dataviz/lidar_viz.ipynb)\n",
"[![image](https://img.shields.io/badge/Open-Planetary%20Computer-black?style=flat&logo=microsoft)](https://pccompute.westeurope.cloudapp.azure.com/compute/hub/user-redirect/git-pull?repo=https://github.com/opengeos/geoai&urlpath=lab/tree/geoai/examples/dataviz/lidar_viz.ipynb&branch=main)\n",
"[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/opengeos/geoai/blob/main/examples/dataviz/lidar_viz.ipynb)\n",
"\n",
"# Visualizing LiDAR Data with Leafmap\n",
"\n",
"This notebook demonstrates how to visualize LiDAR data using [leafmap](https://leafmap.org).\n",
"\n",
"## Installation\n",
"\n",
"Uncomment and run the following cell to install the required Python packages."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# %pip install \"leafmap[lidar]\" open3d"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Import libraries"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import leafmap"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Download data"
]
},
{
"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": 2,
"metadata": {},
"outputs": [],
"source": [
"url = 'https://open.gishub.org/data/lidar/madison.zip'\n",
"filename = 'madison.las'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"leafmap.download_file(url, 'madison.zip', unzip=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Metadata"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Read the LiDAR data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"las = leafmap.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": [
"## Read data"
]
},
{
"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": [
"## PyVista\n",
"\n",
"Visualize LiDAR data using the [pyvista](https://github.com/pyvista/pyvista) backend."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"leafmap.view_lidar(filename, cmap='terrain', backend='pyvista')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](https://i.imgur.com/xezcgMP.gif)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## ipygany\n",
"\n",
"Visualize LiDAR data using the [ipygany](https://github.com/QuantStack/ipygany) backend."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"leafmap.view_lidar(filename, backend='ipygany', background='white')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](https://i.imgur.com/MyMWW4I.gif)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Panel\n",
"\n",
"Visualize LiDAR data using the [panel](https://github.com/holoviz/panel) backend."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"leafmap.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": [
"## Open3D\n",
"\n",
"Visualize LiDAR data using the [open3d](http://www.open3d.org) backend."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"leafmap.view_lidar(filename, backend='open3d')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](https://i.imgur.com/rL85fbl.gif)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "geo",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 109d5a8

Please sign in to comment.