# [gdal-dev] Re: Hillshade + Topographic Map??

Joaquim Luis jluis at ualg.pt
Tue Feb 21 10:11:44 EST 2012

```On 21-02-2012 14:11, Rutger wrote:
> Hey,
>
>
> TJMartin wrote
>> ...
>> Is there a way to combine the hillshade and topo map together - ie add a
>> transparency or opacity to the hillshade.
>> ...
>>
> A common way is to convert your (i assume) RGB topo map to HSV color space
> and replace the intensity band (v) with your hillshade. This is for example
> nicely shows at Franks blog:
> http://fwarmerdam.blogspot.com/2010/01/hsvmergepy.html
> http://fwarmerdam.blogspot.com/2010/01/hsvmergepy.html
>
> I find replacing the entire intensity band always a bit harsh since for flat
> area's you would like to stick to your original color/data.
>
> This can be done by normalizing the hillshade band with the zenith angle
> used to create is. Following the hsv_merge.py script on Franks blog, the
> original replacement of:
> /hsv_adjusted = numpy.asarray( [hsv[0], hsv[1], v] )/
>
> Woud become something like:
> /v_norm = v * hsv[2] / ( 255 * math.cos(zenith * (math.pi / 180.0)))
> hsv_adjusted = numpy.asarray( [hsv[0], hsv[1], numpy.where( v_norm>  255,
> 255, v_norm )] )/
>
> You have to pay a bit attention to avoid saturating the normalized band.
> This can be done by choosing a zenith angle wich gives a flat surface a
> value halfway your range of 0 and 255.

GMT does that for ages. But it doesn't replace the intensity with
making the  facets facing illumination light become brighter and the
other become darker.

See for example
http://gmt.soest.hawaii.edu/gmt/html/GMT_Docs.html#x1-1420007.17

and
http://gmt.soest.hawaii.edu/gmt/html/GMT_Docs.html#x1-1580008.2

With GMT5 one can compute the shading of a grid and apply it to an
image. Here  goes a small example of the GMT's test set

Even simpler is to use Mirone. We can do the above just with a couple of
clicks.

Joaquim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture.JPG
Type: image/jpeg
Size: 28153 bytes
Desc: not available