When you are hiking, cycling, skiing or do any other activity in mountain area, it is useful to have map that gives you overview about terrain. Clasic way how to provide this overview in 2D map is adding contour lines. For fast overview and good-looking map is great to add even hillshades.
I was using hillshade tiles provided by Heidelberg university for my project - OSM Scout for Sailfish OS. They allow me to use it for my non-profit project, but without any guaranties. This “korona” hillshade server stops working few months ago unfortunately, it just reply with HTTP code 503 “Service Unavailable” to every request. I don’t try to contact them, but tried to find a way how to deploy own tile server…
On the internet exists many tutorials how to generate hillshade layer and tiles for specific area and generate tiles from it. I read these two: “Create beautiful hillshade maps…” from Michael Corey and “Creating Hill Shaded Tile Overlays” from Alastair Aitchison. But no tutorial nor project don’t allow me to build tile server with global coverage.
Long story short, I combined all steps to one Python script that generate hillshade image using GDAL library and transform it to png tile using Python Imaging Library. For generating tile on demand on web server, I wrote simple PHP script. It looks to tile cache on the server first and if this tile was not generated yet, executes python script. GDAL library may be memory expensive, to avoid denial of service by memory exhaustion, I needed to limit maximum count of parallel python processes. To do this, I wrote spin lock with shared counter in Memcached. For this solution inspires me blog post on leaseweb.com.
You can try result here (using Leaflet JavaScript library), and clone source code from Github: Hillshade tile server.
토론
2021년 12월 31일 06:02에 LucGommans님의 의견
That’s quite useful, thank you!
2022년 3월 28일 20:40에 Andre-G님의 의견
Hi Karry,
great work, thank you! Im currently testing your hillshade tiles in Little Navmap, an open source flight simulation navigation program. Because the underlying marble engine doesnt like “&” in URLs, i wrote a little wrapper running in front of your demo-tileserver. Later i will do some caching or maybe do the whole rendering at my site.
For now, if you see requests from hq.networklabs.de (81.20.117.79), its me. If i hit you too much, leave me a message and i will change it.
cheers Andre
2022년 3월 29일 08:26에 Karry님의 의견
Hi Andre.
Thank you for give me know. My server should survive some load, but keep in mind that it is Raspberry Pi 4 :-) So, it has limited memory and tile rendering is restraint just two parallel jobs. So it would be great if you keep just one connection and possibly prepare own server when you will need smaller latencies. I may provide you archive with dem data (80 GiB), originally from http://viewfinderpanoramas.org/Coverage%20map%20viewfinderpanoramas_org3.htm and help you with the setup.
Regards, Lukas
2024년 1월 2일 23:11에 VinceFromNice님의 의견
Thanks Karry, that’s very nice !
The Wikimedia foundation provided tiles for hill shading (at http://tiles.wmflabs.org/hillshading/{z}/{x}/{y}.png) but apparently it’s not available anymore so your server is very usefull !