A lightweight and straightforward tool to clip Digital Elevation Models (DEMs) using a shapefile or GeoJSON polygon.
- Clip elevation GeoTIFFs using an AOI polygon
- Outputs clipped raster with retained metadata
- Clone the repo or download the files:
git clone https://github.com/yourusername/dem-clip.git
cd dem-clip- Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install the dependencies:
pip install -r requirements.txtMake sure you have:
- A
.tifDEM file (e.g.,input.tif) - A
.geojsonor.shpfile for the area of interest (AOI)
Then run:
python clip_dem.py --input examples/input.tif --aoi examples/aoi.geojson --output clipped.tifdem-clip/
├── clip_dem.py
├── requirements.txt
├── README.md
├── LICENSE
└── examples/
├── input.tif # Your DEM file
└── aoi.geojson # Your AOI file
MIT License