Skip to content
/ dsm2dtm Public
forked from seedlit/dsm2dtm

Generates DTM (Digital Terrain Model) from DSM (Digital Surface Model).

License

Notifications You must be signed in to change notification settings

geo-py/dsm2dtm

 
 

Repository files navigation

dsm2dtm

This repo generates DTM (Digital Terrain Model) from DSM (Digital Surface Model).

GitHub Anaconda-Server Badge Conda Version GitHub contributors Python Version Supported Anaconda-Server Badge

Installation

Note: We are unable to install Saga as part of the dependency, as it is not avilable on PyPI or conda.
To install saga_cmd - sudo apt update; sudo apt install saga

From Conda:

conda install -c conda-forge dsm2dtm 

These step are for Linux. This will differ a bit for MacOS and windows.

From Source

# Step 1: Clone the repo
% git clone https://github.com/seedlit/dsm2dtm.git
# Step 2: Move in the folder
% cd dsm2dtm
# Step 3: Create a virtual environment
% python3 -m venv venv
# Step 4: Activate the environment
% source venv/bin/activate
# Step 5: Install requirements
% pip install -r requirements.txt
# Step 6: Install saga_cmd
% sudo apt update
% sudo apt install saga

Usage

Run the script dsm2dtm.py and pass the dsm path as argument.

python dsm2dtm.py --dsm data/sample_dsm.tif

Example1: Input DSM and generated DTM over a flat terrain

example

Example2: Input DSM, generated DTM, and groundtruth DTM (Lidar derived) over a hillside terrain

DSM was derived from this point cloud data example

TODO

  • Add tests and coverage
  • Add poetry (with separate dependencies for dev: black, isort, pyest, etc.)
  • Add pre-commit hooks (isort, black, mypy)
  • Add documentation
  • Move test file(s) to remote server OR use gitlfs OR use fake-geo-images
  • Reduce I/O by passing rasterio object instead of raster path
  • Add exception handling
  • use SAGA python API instead of command line ineterface (saga_cmd)
  • upsample generated DTM if the source DSM was downsampled
  • setup docker-compose (and maybe expose as FastAPI app?)

About

Generates DTM (Digital Terrain Model) from DSM (Digital Surface Model).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%