Skip to content

Creating better contourlines from digital elevation models

License

Notifications You must be signed in to change notification settings

MathiasGroebe/Smooth-Contours

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smooth Contour Lines

Creating better contour lines from digital elevation models, especially in flat areas. Implementing the algorithm with GDAL after:

P. Kettunen, C. Koski, and J. Oksanen, “A design of contour generation for topographic maps with adaptive DEM smoothing,” International Journal of Cartography, vol. 3, no. 1, pp. 19–30, Jun. 2017. DOI: 10.1080/23729333.2017.1300998

Usage

create_contours.py --inputDEM=DEMfile.tif --outputFile=contours.gpkg --interval=5 --pixelSize=2

Input is as DEM in any GDAL readable raster format. The output format is guessed from the extension of the file name and can be any file-based vector format supported by gdal_contour. The script calculate also the length of the contour lines. Finde the lenght of each line in the attribute "line_length" and use it to hide to short contour lines.

The script needs Python and GDAL. On Windows, it should run in the OSGeo4W Shell.

Example

The following example image pair demonstrates the result of the generalization process. The contour lines are wrong in some areas but look overall better and smoother. Example for the "Sächsische Schweiz" made with the DEM (20-meter resolution) form the GeoSN. Data source GeoSN, dl-de/by-2-0 Example

TODO

  • Muliline to Singleline
  • Mark closed lines
  • Code cleanup
  • Write tests

About

Creating better contourlines from digital elevation models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages