I have my OSM data in a local server. I already done with the contour lines using Phyghtmap and achieve a good result.

Now I'm trying to show the relief "shadows" like this beautiful map:enter image description here

I know it is not OSM data, just some kind of transparent PNG layer, but I don't know how to create it...


By reading this I'm now able to convert my HGT files downloaded by Phyghtmap to GeoTIFF but it have a very bad resolution...

enter image description here


You can use gdaldem hillshade to create hillshades.

This command outputs an 8-bit raster with a nice shaded relief effect. It’s very useful for visualizing the terrain. You can optionally specify the azimuth and altitude of the light source, a vertical exaggeration factor and a scaling factor to account for differences between vertical and horizontal units.

The value 0 is used as the output nodata value.

The following specific options are available :

-z zFactor:
vertical exaggeration used to pre-multiply the elevations
-s scale:
ratio of vertical units to horizontal. If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can use scale=111120 if the vertical units are meters (or scale=370400 if they are in feet)
-az azimuth:
azimuth of the light, in degrees. 0 if it comes from the top of the raster, 90 from the east, ... The default value, 315, should rarely be changed as it is the value generally used to generate shaded maps.
-alt altitude:
altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light.
(starting with GDAL 1.10) combined shading, a combination of slope and oblique shading.
(starting with GDAL 2.2) multidirectional shading, a combination of hillshading illuminated from 225 deg, 270 deg, 315 deg, and 360 deg azimuth.

The result you show in your EDIT is an expected result. However, the shade effect is very stark, which is probably not what you want for an overlay. To get a lighter/smoother result, make sure you have the correct -s factor set for your source height data, and then use the -z factor to tweak the vertical exaggeration.

Alternatively, you can use regular image manipulation to smoothen the image to produce an overlay that is pleasant for your usecase.


I'd say use gdaladdo like others suggested, the ugly look is probably due to high z exxageration and too high resolution... try with a smaller z factor, and then add overviews to the output, that might help (otherwise, you'll need to find a too to perform an interpolation pass even on the native resolution, you might want to look at https://mapzen.com/blog/terrain-generalization/ )

Then, import it in GeoServer and use multiply compositing to get a good looking result when merging it with your base map.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.