PHP+Python scripts for building simple server with hillshade tiles
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md add link to demo Jan 8, 2019
config.php.example make possible to limit concurrency of python hillshade generator Dec 20, 2018
empty.png basic project structure Dec 17, 2018
hillshade.py
index.html decrease maxZoom to 18 Dec 23, 2018
leaflet-hash.js basic project structure Dec 17, 2018
leaflet.css basic project structure Dec 17, 2018
leaflet.js basic project structure Dec 17, 2018
screenshot.png add screenshot Dec 18, 2018
tile.php fix cache headers Dec 21, 2018

README.md

Hillshade tile server

PHP+Python scripts for building simple server with hillshade tiles. You can try result here.

river relief

Prapare DEM data

  • Download DEM data for requested region from SRTM site or other source, for example viewfinderpanoramas.org
  • Convert DEM data to GeoTif format with GDAL tool
find /data/dem/ -type f -name *.hgt | \
while read file ; do \
    gdal_translate -of GTiff "$file" "$file.tif" \
done
  • Build GDAL virtual data set from multiple files
find /data/dem/ -type f -name *.hgt.tif > /data/dem/files.lst
gdalbuildvrt -input_file_list /data/dem/files.lst /data/dem/full.vrt
  • Downscale data for low zoom (<= 7)
cd /data/dem
gdalwarp \
    -of GTiff \
    -dstnodata 0 \
    -t_srs "EPSG:3857" \
    -r "cubic" \
    -multi \
    -co "TILED=YES" \
    -ts 65536 0 \
    "files.vrt" \
    "low-zoom-7.tif"

gdalwarp \
    -of GTiff \
    -dstnodata 0 \
    -t_srs "EPSG:3857" \
    -r "cubic" \
    -multi \
    -co "TILED=YES" \
    -ts 8192 0 \
    "files.vrt" \
    "low-zoom-4.tif"

Web server

  • it is required web server with PHP support (apache2 for example), memcached server with corresponding PHP module, python3 with gdal and Imaging (PIL) module...
  • copy this repository to web server root dir, rename config.php.example to config.php and setup paths and other properties for your server
  • prepare script for cleanup tile cache and add it to system cron
TODO

Third-party software