WikimapsAtlas / WikimapsAtlas-generator

A command line utility to convert heavy GIS sources into elegant administrative & topographic topojson files, raster files, and web friendly svg maps.
MIT License
45 stars 6 forks source link

Add denoise/smoothing for hillshades #4

Open hugolpz opened 9 years ago

hugolpz commented 9 years ago

See How to smooth a DEM? :

# gdal_translate -of AAIGrid my_dem.tif my_dem.asc      # convert to .asc
mdenoise -i my_dem.asc -n 5 -t 0.99 -o my_dem_DN.asc    # denoise
# gdal_translate -of GTiff my_dem_DN.asc my_dem_DN.tif  # convert back to .tif
hugolpz commented 9 years ago

Results are buggy. Need to create a test project to find the right parameters:

mkdir -p ./scripts
curl -L -C - 'http://www.cs.cf.ac.uk/meshfiltering/index_files/Doc/mdsource.zip' -o './scripts/mdsource.zip'
unzip -n ./scripts/mdsource.zip -d ./scripts/
g++ -Wno-write-strings -o ./scripts/mdenoise/mdenoise ./scripts/mdenoise/mdenoise.cpp ./scripts/mdenoise/triangle.c
# ln -s `pwd`/mdenoise /some/directory/on/the/$PATH

and

gdal_translate -of AAIGrid hillshades.tmp.tif hillshades.tmp.asc                        # convert to .asc
./scripts/mdenoise/mdenoise -i hillshades.tmp.asc -n 20 -t 0.99 -o hillshades_denoised.tmp.asc          # denoise
gdal_translate -of GTiff hillshades_denoised.tmp.asc hillshades_denoised_xs.tmp.tif # convert back to .tif