A geospatial web application for defense planning, allowing users to simulate viewshed (visibility) and line-of-sight (LOS) analysis over terrain using digital elevation models (DEMs).
- Viewshed Simulation: Compute and visualize areas visible from an observer point at a given height and location.
- Line of Sight Checker: Check if a direct line of sight exists between two points (observer and target) with specified heights.
- Interactive Maps: Results are displayed on interactive Folium maps in the browser.
- Backend Scripts: FastAPI backend for geospatial computation; Python scripts for raster viewshed analysis.
DefenseVisiblity/
├── defense_los/
│ ├── app.py # Streamlit frontend app
│ ├── compute_viewshed.py # Standalone viewshed computation script
│ ├── ... # Other backend files
├── data/ # DEMs and output files
├── README.md # Project documentation
- Install dependencies:
- Python 3.8+
- Install required packages:
pip install streamlit folium streamlit-folium requests rasterio numpy scipy fastapi uvicorn
- Prepare DEM data:
- Place your GeoTIFF DEM file in the
data/folder.
- Place your GeoTIFF DEM file in the
- Start the backend (FastAPI):
- (Assuming you have a FastAPI backend exposing
/viewshedand/losendpoints) - Example:
uvicorn backend:app --reload --port 8000
- (Assuming you have a FastAPI backend exposing
- Start the frontend (Streamlit):
streamlit run defense_los/app.py
- Open your browser:
- Visit http://localhost:8501
- Run viewshed analysis directly from CLI:
python defense_los/compute_viewshed.py --lon <lon> --lat <lat> --height <h> --maxdist <m> --dem data/demo_aoi.tif
- Output is a GeoJSON file with visible polygons.
- For best results, use high-resolution DEMs.
- The app caches results for faster repeated queries.
- Morphological smoothing in viewshed script requires
scipy.