Note
Go to the end to download the full example code
Mine Pit Imagery
Triangulate a surface from a point cloud of points and overlay imagery of a mine pit.
Originally posted: pyvista/pyvista-support#159
# sphinx_gallery_thumbnail_number = 2
import numpy as np
import pooch
import pyvista as pv
import rioxarray
url = "https://raw.githubusercontent.com/pyvista/vtk-data/master/Data/Sio020320.csv"
file_path = pooch.retrieve(url=url, known_hash=None)
points = np.loadtxt(file_path, skiprows=1, delimiter=",")[:, 1:]
cloud = pv.PolyData(points)
# Plot the point cloud with a special rendering technique
cloud.plot(eye_dome_lighting=True)
Triangulate the points
# This will take a minute
surf = cloud.delaunay_2d(progress_bar=True)
0%| [00:00<?]
Computing 2D Triangulation: 0%| [00:00<?]
Computing 2D Triangulation: 0%| [00:00<00:48]
Computing 2D Triangulation: 1%| [00:00<00:54]
Computing 2D Triangulation: 1%| [00:00<01:04]
Computing 2D Triangulation: 1%| [00:00<01:10]
Computing 2D Triangulation: 1%|▏ [00:00<01:15]
Computing 2D Triangulation: 1%|▏ [00:01<01:23]
Computing 2D Triangulation: 2%|▏ [00:01<01:29]
Computing 2D Triangulation: 2%|▏ [00:01<01:35]
Computing 2D Triangulation: 2%|▏ [00:01<01:39]
Computing 2D Triangulation: 2%|▏ [00:01<01:44]
Computing 2D Triangulation: 2%|▏ [00:02<01:48]
Computing 2D Triangulation: 2%|▏ [00:02<01:53]
Computing 2D Triangulation: 3%|▎ [00:02<01:57]
Computing 2D Triangulation: 3%|▎ [00:02<01:59]
Computing 2D Triangulation: 3%|▎ [00:02<02:02]
Computing 2D Triangulation: 3%|▎ [00:03<02:06]
Computing 2D Triangulation: 3%|▎ [00:03<02:09]
Computing 2D Triangulation: 3%|▎ [00:03<02:17]
Computing 2D Triangulation: 4%|▎ [00:03<02:18]
Computing 2D Triangulation: 4%|▍ [00:04<02:22]
Computing 2D Triangulation: 4%|▍ [00:04<02:25]
Computing 2D Triangulation: 4%|▍ [00:04<02:29]
Computing 2D Triangulation: 4%|▍ [00:04<02:36]
Computing 2D Triangulation: 4%|▍ [00:05<02:40]
Computing 2D Triangulation: 5%|▍ [00:05<02:44]
Computing 2D Triangulation: 5%|▍ [00:05<02:43]
Computing 2D Triangulation: 5%|▍ [00:06<02:43]
Computing 2D Triangulation: 5%|▌ [00:06<02:44]
Computing 2D Triangulation: 5%|▌ [00:06<02:43]
Computing 2D Triangulation: 5%|▌ [00:06<02:44]
Computing 2D Triangulation: 6%|▌ [00:07<02:45]
Computing 2D Triangulation: 6%|▌ [00:07<02:44]
Computing 2D Triangulation: 6%|▌ [00:07<02:44]
Computing 2D Triangulation: 6%|▌ [00:08<02:47]
Computing 2D Triangulation: 6%|▌ [00:08<02:46]
Computing 2D Triangulation: 6%|▋ [00:08<02:48]
Computing 2D Triangulation: 7%|▋ [00:09<02:49]
Computing 2D Triangulation: 7%|▋ [00:09<02:47]
Computing 2D Triangulation: 7%|▋ [00:09<02:42]
Computing 2D Triangulation: 7%|▋ [00:09<02:39]
Computing 2D Triangulation: 7%|▋ [00:10<02:38]
Computing 2D Triangulation: 7%|▋ [00:10<02:39]
Computing 2D Triangulation: 8%|▊ [00:10<02:36]
Computing 2D Triangulation: 8%|▊ [00:10<02:33]
Computing 2D Triangulation: 8%|▊ [00:11<02:26]
Computing 2D Triangulation: 8%|▊ [00:11<02:20]
Computing 2D Triangulation: 8%|▊ [00:11<02:16]
Computing 2D Triangulation: 8%|▊ [00:11<02:12]
Computing 2D Triangulation: 9%|▊ [00:12<02:09]
Computing 2D Triangulation: 9%|▊ [00:12<02:06]
Computing 2D Triangulation: 9%|▉ [00:12<02:03]
Computing 2D Triangulation: 9%|▉ [00:12<02:00]
Computing 2D Triangulation: 9%|▉ [00:12<01:59]
Computing 2D Triangulation: 9%|▉ [00:13<01:49]
Computing 2D Triangulation: 10%|▉ [00:13<01:24]
Computing 2D Triangulation: 10%|▉ [00:13<01:07]
Computing 2D Triangulation: 10%|█ [00:13<00:57]
Computing 2D Triangulation: 11%|█ [00:13<00:54]
Computing 2D Triangulation: 11%|█ [00:13<00:50]
Computing 2D Triangulation: 11%|█▏ [00:14<00:48]
Computing 2D Triangulation: 12%|█▏ [00:14<00:47]
Computing 2D Triangulation: 12%|█▏ [00:14<00:46]
Computing 2D Triangulation: 12%|█▏ [00:14<00:45]
Computing 2D Triangulation: 13%|█▎ [00:14<00:44]
Computing 2D Triangulation: 13%|█▎ [00:14<00:44]
Computing 2D Triangulation: 13%|█▎ [00:15<00:44]
Computing 2D Triangulation: 14%|█▎ [00:15<00:43]
Computing 2D Triangulation: 14%|█▍ [00:15<00:43]
Computing 2D Triangulation: 14%|█▍ [00:15<00:43]
Computing 2D Triangulation: 15%|█▍ [00:15<00:43]
Computing 2D Triangulation: 15%|█▍ [00:15<00:45]
Computing 2D Triangulation: 15%|█▌ [00:16<00:45]
Computing 2D Triangulation: 16%|█▌ [00:16<00:45]
Computing 2D Triangulation: 16%|█▌ [00:16<00:45]
Computing 2D Triangulation: 16%|█▌ [00:16<00:44]
Computing 2D Triangulation: 17%|█▋ [00:16<00:44]
Computing 2D Triangulation: 17%|█▋ [00:16<00:43]
Computing 2D Triangulation: 17%|█▋ [00:17<00:43]
Computing 2D Triangulation: 18%|█▊ [00:17<00:42]
Computing 2D Triangulation: 18%|█▊ [00:17<00:41]
Computing 2D Triangulation: 18%|█▊ [00:17<00:41]
Computing 2D Triangulation: 18%|█▊ [00:17<00:41]
Computing 2D Triangulation: 19%|█▉ [00:17<00:40]
Computing 2D Triangulation: 19%|█▉ [00:18<00:40]
Computing 2D Triangulation: 19%|█▉ [00:18<00:39]
Computing 2D Triangulation: 20%|█▉ [00:18<00:39]
Computing 2D Triangulation: 20%|██ [00:18<00:38]
Computing 2D Triangulation: 20%|██ [00:18<00:39]
Computing 2D Triangulation: 21%|██ [00:18<00:39]
Computing 2D Triangulation: 21%|██ [00:19<00:39]
Computing 2D Triangulation: 21%|██▏ [00:19<00:39]
Computing 2D Triangulation: 22%|██▏ [00:19<00:40]
Computing 2D Triangulation: 22%|██▏ [00:19<00:41]
Computing 2D Triangulation: 22%|██▏ [00:19<00:40]
Computing 2D Triangulation: 23%|██▎ [00:19<00:39]
Computing 2D Triangulation: 23%|██▎ [00:20<00:39]
Computing 2D Triangulation: 23%|██▎ [00:20<00:39]
Computing 2D Triangulation: 24%|██▎ [00:20<00:39]
Computing 2D Triangulation: 24%|██▍ [00:20<00:40]
Computing 2D Triangulation: 24%|██▍ [00:20<00:39]
Computing 2D Triangulation: 25%|██▍ [00:20<00:40]
Computing 2D Triangulation: 25%|██▌ [00:21<00:40]
Computing 2D Triangulation: 25%|██▌ [00:21<00:40]
Computing 2D Triangulation: 26%|██▌ [00:21<00:40]
Computing 2D Triangulation: 26%|██▌ [00:21<00:40]
Computing 2D Triangulation: 26%|██▋ [00:21<00:39]
Computing 2D Triangulation: 27%|██▋ [00:22<00:39]
Computing 2D Triangulation: 27%|██▋ [00:22<00:39]
Computing 2D Triangulation: 27%|██▋ [00:22<00:39]
Computing 2D Triangulation: 28%|██▊ [00:22<00:39]
Computing 2D Triangulation: 28%|██▊ [00:22<00:38]
Computing 2D Triangulation: 28%|██▊ [00:22<00:38]
Computing 2D Triangulation: 29%|██▊ [00:23<00:38]
Computing 2D Triangulation: 29%|██▉ [00:23<00:38]
Computing 2D Triangulation: 29%|██▉ [00:23<00:37]
Computing 2D Triangulation: 30%|██▉ [00:23<00:36]
Computing 2D Triangulation: 30%|██▉ [00:23<00:37]
Computing 2D Triangulation: 30%|███ [00:23<00:37]
Computing 2D Triangulation: 31%|███ [00:24<00:37]
Computing 2D Triangulation: 31%|███ [00:24<00:36]
Computing 2D Triangulation: 31%|███▏ [00:24<00:35]
Computing 2D Triangulation: 32%|███▏ [00:24<00:35]
Computing 2D Triangulation: 32%|███▏ [00:24<00:33]
Computing 2D Triangulation: 32%|███▏ [00:24<00:32]
Computing 2D Triangulation: 33%|███▎ [00:25<00:32]
Computing 2D Triangulation: 33%|███▎ [00:25<00:33]
Computing 2D Triangulation: 33%|███▎ [00:25<00:32]
Computing 2D Triangulation: 34%|███▎ [00:25<00:33]
Computing 2D Triangulation: 34%|███▍ [00:25<00:33]
Computing 2D Triangulation: 34%|███▍ [00:25<00:32]
Computing 2D Triangulation: 35%|███▍ [00:26<00:31]
Computing 2D Triangulation: 35%|███▍ [00:26<00:30]
Computing 2D Triangulation: 35%|███▌ [00:26<00:30]
Computing 2D Triangulation: 36%|███▌ [00:26<00:30]
Computing 2D Triangulation: 36%|███▌ [00:26<00:29]
Computing 2D Triangulation: 36%|███▌ [00:26<00:30]
Computing 2D Triangulation: 37%|███▋ [00:26<00:30]
Computing 2D Triangulation: 37%|███▋ [00:27<00:31]
Computing 2D Triangulation: 37%|███▋ [00:27<00:31]
Computing 2D Triangulation: 37%|███▋ [00:27<00:31]
Computing 2D Triangulation: 38%|███▊ [00:27<00:31]
Computing 2D Triangulation: 38%|███▊ [00:27<00:31]
Computing 2D Triangulation: 38%|███▊ [00:27<00:31]
Computing 2D Triangulation: 39%|███▉ [00:28<00:31]
Computing 2D Triangulation: 39%|███▉ [00:28<00:31]
Computing 2D Triangulation: 39%|███▉ [00:28<00:30]
Computing 2D Triangulation: 40%|███▉ [00:28<00:30]
Computing 2D Triangulation: 40%|████ [00:28<00:29]
Computing 2D Triangulation: 40%|████ [00:28<00:28]
Computing 2D Triangulation: 41%|████ [00:29<00:28]
Computing 2D Triangulation: 41%|████ [00:29<00:27]
Computing 2D Triangulation: 41%|████▏ [00:29<00:27]
Computing 2D Triangulation: 42%|████▏ [00:29<00:27]
Computing 2D Triangulation: 42%|████▏ [00:29<00:26]
Computing 2D Triangulation: 42%|████▏ [00:29<00:26]
Computing 2D Triangulation: 43%|████▎ [00:30<00:27]
Computing 2D Triangulation: 43%|████▎ [00:30<00:27]
Computing 2D Triangulation: 43%|████▎ [00:30<00:26]
Computing 2D Triangulation: 44%|████▎ [00:30<00:26]
Computing 2D Triangulation: 44%|████▍ [00:30<00:26]
Computing 2D Triangulation: 44%|████▍ [00:30<00:26]
Computing 2D Triangulation: 45%|████▍ [00:30<00:26]
Computing 2D Triangulation: 45%|████▌ [00:31<00:26]
Computing 2D Triangulation: 45%|████▌ [00:31<00:26]
Computing 2D Triangulation: 46%|████▌ [00:31<00:26]
Computing 2D Triangulation: 46%|████▌ [00:31<00:26]
Computing 2D Triangulation: 46%|████▋ [00:31<00:26]
Computing 2D Triangulation: 47%|████▋ [00:31<00:25]
Computing 2D Triangulation: 47%|████▋ [00:32<00:25]
Computing 2D Triangulation: 47%|████▋ [00:32<00:24]
Computing 2D Triangulation: 48%|████▊ [00:32<00:24]
Computing 2D Triangulation: 48%|████▊ [00:32<00:24]
Computing 2D Triangulation: 48%|████▊ [00:32<00:24]
Computing 2D Triangulation: 49%|████▊ [00:32<00:24]
Computing 2D Triangulation: 49%|████▉ [00:33<00:24]
Computing 2D Triangulation: 49%|████▉ [00:33<00:24]
Computing 2D Triangulation: 50%|████▉ [00:33<00:24]
Computing 2D Triangulation: 50%|████▉ [00:33<00:24]
Computing 2D Triangulation: 50%|█████ [00:33<00:24]
Computing 2D Triangulation: 51%|█████ [00:33<00:23]
Computing 2D Triangulation: 51%|█████ [00:33<00:23]
Computing 2D Triangulation: 51%|█████ [00:34<00:24]
Computing 2D Triangulation: 52%|█████▏ [00:34<00:24]
Computing 2D Triangulation: 52%|█████▏ [00:34<00:24]
Computing 2D Triangulation: 52%|█████▏ [00:34<00:23]
Computing 2D Triangulation: 53%|█████▎ [00:34<00:23]
Computing 2D Triangulation: 53%|█████▎ [00:34<00:22]
Computing 2D Triangulation: 53%|█████▎ [00:35<00:22]
Computing 2D Triangulation: 54%|█████▎ [00:35<00:22]
Computing 2D Triangulation: 54%|█████▍ [00:35<00:22]
Computing 2D Triangulation: 54%|█████▍ [00:35<00:22]
Computing 2D Triangulation: 55%|█████▍ [00:35<00:22]
Computing 2D Triangulation: 55%|█████▍ [00:35<00:22]
Computing 2D Triangulation: 55%|█████▌ [00:36<00:22]
Computing 2D Triangulation: 55%|█████▌ [00:36<00:22]
Computing 2D Triangulation: 56%|█████▌ [00:36<00:21]
Computing 2D Triangulation: 56%|█████▌ [00:36<00:21]
Computing 2D Triangulation: 56%|█████▋ [00:36<00:21]
Computing 2D Triangulation: 57%|█████▋ [00:36<00:22]
Computing 2D Triangulation: 57%|█████▋ [00:37<00:22]
Computing 2D Triangulation: 57%|█████▋ [00:37<00:22]
Computing 2D Triangulation: 58%|█████▊ [00:37<00:21]
Computing 2D Triangulation: 58%|█████▊ [00:37<00:21]
Computing 2D Triangulation: 58%|█████▊ [00:37<00:20]
Computing 2D Triangulation: 59%|█████▉ [00:37<00:20]
Computing 2D Triangulation: 59%|█████▉ [00:38<00:20]
Computing 2D Triangulation: 59%|█████▉ [00:38<00:20]
Computing 2D Triangulation: 60%|█████▉ [00:38<00:20]
Computing 2D Triangulation: 60%|██████ [00:38<00:20]
Computing 2D Triangulation: 60%|██████ [00:38<00:20]
Computing 2D Triangulation: 61%|██████ [00:38<00:19]
Computing 2D Triangulation: 61%|██████ [00:39<00:19]
Computing 2D Triangulation: 61%|██████▏ [00:39<00:19]
Computing 2D Triangulation: 62%|██████▏ [00:39<00:19]
Computing 2D Triangulation: 62%|██████▏ [00:39<00:19]
Computing 2D Triangulation: 62%|██████▏ [00:39<00:19]
Computing 2D Triangulation: 63%|██████▎ [00:39<00:19]
Computing 2D Triangulation: 63%|██████▎ [00:40<00:19]
Computing 2D Triangulation: 63%|██████▎ [00:40<00:20]
Computing 2D Triangulation: 64%|██████▎ [00:40<00:20]
Computing 2D Triangulation: 64%|██████▍ [00:40<00:20]
Computing 2D Triangulation: 64%|██████▍ [00:40<00:19]
Computing 2D Triangulation: 65%|██████▍ [00:41<00:19]
Computing 2D Triangulation: 65%|██████▍ [00:41<00:18]
Computing 2D Triangulation: 65%|██████▌ [00:41<00:18]
Computing 2D Triangulation: 66%|██████▌ [00:41<00:18]
Computing 2D Triangulation: 66%|██████▌ [00:41<00:18]
Computing 2D Triangulation: 66%|██████▋ [00:41<00:18]
Computing 2D Triangulation: 67%|██████▋ [00:42<00:18]
Computing 2D Triangulation: 67%|██████▋ [00:42<00:18]
Computing 2D Triangulation: 67%|██████▋ [00:42<00:18]
Computing 2D Triangulation: 68%|██████▊ [00:42<00:17]
Computing 2D Triangulation: 68%|██████▊ [00:42<00:17]
Computing 2D Triangulation: 68%|██████▊ [00:42<00:17]
Computing 2D Triangulation: 69%|██████▊ [00:43<00:17]
Computing 2D Triangulation: 69%|██████▉ [00:43<00:16]
Computing 2D Triangulation: 69%|██████▉ [00:43<00:16]
Computing 2D Triangulation: 70%|██████▉ [00:43<00:16]
Computing 2D Triangulation: 70%|██████▉ [00:43<00:16]
Computing 2D Triangulation: 70%|███████ [00:44<00:16]
Computing 2D Triangulation: 71%|███████ [00:44<00:16]
Computing 2D Triangulation: 71%|███████ [00:44<00:16]
Computing 2D Triangulation: 71%|███████ [00:44<00:16]
Computing 2D Triangulation: 72%|███████▏ [00:44<00:15]
Computing 2D Triangulation: 72%|███████▏ [00:44<00:14]
Computing 2D Triangulation: 72%|███████▏ [00:45<00:14]
Computing 2D Triangulation: 73%|███████▎ [00:45<00:14]
Computing 2D Triangulation: 73%|███████▎ [00:45<00:15]
Computing 2D Triangulation: 73%|███████▎ [00:45<00:15]
Computing 2D Triangulation: 73%|███████▎ [00:45<00:14]
Computing 2D Triangulation: 74%|███████▍ [00:46<00:14]
Computing 2D Triangulation: 74%|███████▍ [00:46<00:14]
Computing 2D Triangulation: 74%|███████▍ [00:46<00:14]
Computing 2D Triangulation: 75%|███████▍ [00:46<00:13]
Computing 2D Triangulation: 75%|███████▌ [00:46<00:13]
Computing 2D Triangulation: 75%|███████▌ [00:46<00:13]
Computing 2D Triangulation: 76%|███████▌ [00:47<00:13]
Computing 2D Triangulation: 76%|███████▌ [00:47<00:13]
Computing 2D Triangulation: 76%|███████▋ [00:47<00:13]
Computing 2D Triangulation: 77%|███████▋ [00:47<00:13]
Computing 2D Triangulation: 77%|███████▋ [00:47<00:13]
Computing 2D Triangulation: 77%|███████▋ [00:48<00:12]
Computing 2D Triangulation: 78%|███████▊ [00:48<00:12]
Computing 2D Triangulation: 78%|███████▊ [00:48<00:12]
Computing 2D Triangulation: 78%|███████▊ [00:48<00:12]
Computing 2D Triangulation: 79%|███████▊ [00:48<00:12]
Computing 2D Triangulation: 79%|███████▉ [00:48<00:11]
Computing 2D Triangulation: 79%|███████▉ [00:49<00:11]
Computing 2D Triangulation: 80%|███████▉ [00:49<00:11]
Computing 2D Triangulation: 80%|████████ [00:49<00:11]
Computing 2D Triangulation: 80%|████████ [00:49<00:11]
Computing 2D Triangulation: 81%|████████ [00:49<00:10]
Computing 2D Triangulation: 81%|████████ [00:50<00:10]
Computing 2D Triangulation: 81%|████████▏ [00:50<00:10]
Computing 2D Triangulation: 82%|████████▏ [00:50<00:10]
Computing 2D Triangulation: 82%|████████▏ [00:50<00:09]
Computing 2D Triangulation: 82%|████████▏ [00:50<00:09]
Computing 2D Triangulation: 83%|████████▎ [00:50<00:09]
Computing 2D Triangulation: 83%|████████▎ [00:51<00:08]
Computing 2D Triangulation: 83%|████████▎ [00:51<00:08]
Computing 2D Triangulation: 84%|████████▎ [00:51<00:08]
Computing 2D Triangulation: 84%|████████▍ [00:51<00:08]
Computing 2D Triangulation: 84%|████████▍ [00:51<00:08]
Computing 2D Triangulation: 85%|████████▍ [00:51<00:08]
Computing 2D Triangulation: 85%|████████▍ [00:52<00:07]
Computing 2D Triangulation: 85%|████████▌ [00:52<00:07]
Computing 2D Triangulation: 86%|████████▌ [00:52<00:07]
Computing 2D Triangulation: 86%|████████▌ [00:52<00:07]
Computing 2D Triangulation: 86%|████████▋ [00:52<00:06]
Computing 2D Triangulation: 87%|████████▋ [00:52<00:06]
Computing 2D Triangulation: 87%|████████▋ [00:53<00:06]
Computing 2D Triangulation: 87%|████████▋ [00:53<00:06]
Computing 2D Triangulation: 88%|████████▊ [00:53<00:06]
Computing 2D Triangulation: 88%|████████▊ [00:53<00:05]
Computing 2D Triangulation: 88%|████████▊ [00:53<00:05]
Computing 2D Triangulation: 89%|████████▊ [00:53<00:05]
Computing 2D Triangulation: 89%|████████▉ [00:54<00:05]
Computing 2D Triangulation: 89%|████████▉ [00:54<00:05]
Computing 2D Triangulation: 90%|████████▉ [00:54<00:04]
Computing 2D Triangulation: 90%|████████▉ [00:54<00:04]
Computing 2D Triangulation: 90%|█████████ [00:54<00:04]
Computing 2D Triangulation: 91%|█████████ [00:54<00:04]
Computing 2D Triangulation: 91%|█████████ [00:54<00:04]
Computing 2D Triangulation: 91%|█████████ [00:55<00:04]
Computing 2D Triangulation: 92%|█████████▏[00:55<00:04]
Computing 2D Triangulation: 92%|█████████▏[00:55<00:03]
Computing 2D Triangulation: 92%|█████████▏[00:55<00:03]
Computing 2D Triangulation: 92%|█████████▏[00:55<00:03]
Computing 2D Triangulation: 93%|█████████▎[00:55<00:03]
Computing 2D Triangulation: 93%|█████████▎[00:56<00:03]
Computing 2D Triangulation: 93%|█████████▎[00:56<00:02]
Computing 2D Triangulation: 94%|█████████▍[00:56<00:02]
Computing 2D Triangulation: 94%|█████████▍[00:56<00:02]
Computing 2D Triangulation: 94%|█████████▍[00:56<00:02]
Computing 2D Triangulation: 95%|█████████▍[00:56<00:02]
Computing 2D Triangulation: 95%|█████████▌[00:56<00:01]
Computing 2D Triangulation: 95%|█████████▌[00:56<00:01]
Computing 2D Triangulation: 96%|█████████▌[00:57<00:01]
Computing 2D Triangulation: 96%|█████████▌[00:57<00:01]
Computing 2D Triangulation: 96%|█████████▋[00:57<00:01]
Computing 2D Triangulation: 97%|█████████▋[00:57<00:01]
Computing 2D Triangulation: 97%|█████████▋[00:57<00:01]
Computing 2D Triangulation: 97%|█████████▋[00:57<00:00]
Computing 2D Triangulation: 98%|█████████▊[00:57<00:00]
Computing 2D Triangulation: 98%|█████████▊[00:57<00:00]
Computing 2D Triangulation: 99%|█████████▊[00:58<00:00]
Computing 2D Triangulation: 99%|█████████▉[00:58<00:00]
Computing 2D Triangulation: 99%|█████████▉[00:58<00:00]
Computing 2D Triangulation: 100%|█████████▉[00:58<00:00]
Computing 2D Triangulation: 100%|█████████▉[00:58<00:00]
Computing 2D Triangulation: 100%|██████████[00:58<00:00]
Computing 2D Triangulation: 100%|██████████[00:58<00:00]
Open the GeoTIFF
url = "https://dl.dropbox.com/s/pqgme8qsl95u9un/Sio020320_transparent_mosaic_group1.tif?dl=0"
path = pooch.retrieve(url=url, known_hash=None)
ds = rioxarray.open_rasterio(path)
# Fetch the texture as an image
image = np.moveaxis(ds.values, 0, -1)
# Create the ground control points for texture mapping
o = ds.x.min(), ds.y.min(), 0.0 # Bottom Left
u = ds.x.max(), ds.y.min(), 0.0 # Bottom Right
v = ds.x.min(), ds.y.max(), 0.0 # Lop left
# Note: Z-coordinate doesn't matter
Use the GCPs to map the tex coords
mapped_surf = surf.texture_map_to_plane(o, u, v)
Load the image as a texture to drape over the mesh
aerial_texture = pv.numpy_to_texture(image)
Plot it up in 3D and enjoy!
cpos = [
(469735.37431312964, 1321523.2987377762, 5242.9129552423465),
(469928.4268006842, 1321916.1316302174, 5171.6505267522025),
(0.08372003361058433, 0.13788753708579846, 0.986903228836878),
]
mapped_surf.plot(texture=aerial_texture, cpos=cpos)
Total running time of the script: (1 minutes 24.226 seconds)