Project for exploring stacs and COGs. This project computes and visualizes the viewshed (visible terrain) from a given observer location using high-resolution DEM data (3DEP or NASADEM) and point cloud analysis. It generates both 2D and 3D visualizations of visible terrain, horizon profiles, and more. The tools is very realistic in terms of blocking elevation, therefore some results may be unsatisfying to look at. I would additionally like to extend this to include some bathymetry datasets as well. Currently the script excludes continous flat terrain from plotting for brevity which needs some adjustment.
- Downloads and mosaics DEM tiles from Microsoft Planetary Computer.
- 3DEP proritized for higher resolution in CONUS.
- NASADEM fallback when 3DEP unavailable and outside CONUS
- Projects observer location to UTM and extracts DEM window
- Vectorized computation of visible points and horizon angles for all azimuths
- Multiple visualizations:
- DEM hillshade with visible points (Cartesian and polar)
- Viewshed mask overlay
- Horizon and elevation profiles vs. azimuth
- 3D cylindrical plot of visible points
- Python 3.8+
- NumPy
- Pandas
- Rasterio
- pyproj
- pystac-client
- planetary-computer
- matplotlib
Install dependencies with:
pip install numpy pandas rasterio pyproj pystac-client planetary-computer matplotlib
-
Set Observer Parameters
Edit the observer latitude, longitude, and eye height at the top of Observer_based_pointcloud_viewshed.ipynb:
obs_lat = 42.940389 obs_lon = -122.107171 eye_height = 1.80
-
Run the Notebook
Open Observer_based_pointcloud_viewshed.ipynb in Jupyter or VS Code and run all cells.
-
Visualizations
The notebook will generate:
- DEM hillshade with visible points (Cartesian and polar)
- Viewshed mask overlay (green = visible, red = not visible)
- Horizon angle and elevation profiles vs. azimuth
- 3D cylindrical plot of visible points
- Adjust
max_vis
andpadding
for the maximum visibility radius and DEM window size. - Change
azimuths
,angle_step
, orr_step
for finer or coarser sampling. - Modify plotting code for custom visualizations.
This project is open source and available under the MIT License.