Nejnovější:
- Sailfish OS and memory
- Hillshade tile server
- Statistics of OSM Scout for Sailfish OS
- Nebezpečný router
- Tree model with Silica components
Podle data:
- listopad 2021
- leden 2019
- prosinec 2017
- prosinec 2016
- květen 2014
- duben 2014
- listopad 2013
- duben 2013
- duben 2011
- únor 2011
- leden 2011
- srpen 2010
- květen 2010
- březen 2010
- leden 2010
- říjen 2009
- duben 2009
- únor 2009
- říjen 2008
- září 2008
- srpen 2008
- duben 2008
- březen 2008
- únor 2008
Téma:
Hillshade tile server
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 generates hillshade image using GDAL library and transforms 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.