[GRASSLIST:4448] RE: shaded relief
    Gordon Keith 
    gordon.keith at csiro.au
       
    Tue Sep 10 01:51:02 EDT 2002
    
    
  
On Tue, 10 Sep 2002 01:50, Glynn Clements wrote:
> Markus Neteler wrote:
> > > One pitfall I've encountered is where the horizontal and vertical
> > > units are not the same. If you shade a DEM where the horizontal
> > > resolution is expressed in degrees lat/long, and the vertical in
> > > meters, you will get a very stark relief map indeed, and no
> > > amount of playing with the sun altitude will help. In this case,
> > > you can either reproject the DEM to a coordinate system with
> > > horizontal units in meters, or modify the code in shade.rel.sh.
>
> A fix would involve changing:
>
> 	.../(8.*ewres()) , \\
> to e.g.
> 	.../($scale*8.*ewres()) , \\
>
> (and similarly for nwres).
>
> But how to set "scale"? It depends upon both the horizontal and
> vertical units. The horizontal units can be obtained from the
> PROJ_UNITS file (if it exists). Can the vertical units be determined
> automatically (I suspect not)?
Thanks a lot for this discussion.
I've been wondering for a while why shade.rel.sh produced such lousy 
results.
My fix (FWIW): 
scale=1
for i
do
   case $i in
      altitude=*)
         alt=`echo $i | awk -F '=' '{print $2}'` ; gotitALT=1;;
      azimuth=*)
         az=`echo $i | awk -F '=' '{print $2}'` ; gotitAZ=1;;
      elevation=*)
         elev=`echo $i | awk -F '=' '{print $2}'` ;
         gotitELEV=1;
         eval `g.findfile element=cell file=$elev` ;
         elev="${fullname}" ;
         ELEV="${name}" ;
         if [ "$elev" = "" ] ; then
            echo "ERROR: raster map [`echo $i | awk -F '=' '{print 
$2}'`] does not exist."
            exit 1
         fi ;;
      scale=*)
         scale=`echo $i | awk -F '=' '{print $2}'` ;
         case $scale in
            m|M)
               scale=111120;;
            f|F)
               scale=370400;;
         esac
   esac
done
scale can be m or M to convert lat lon to metres
             f or F to convert lat lon to feet
             any number for user defined scale
I note that this assumes you are always at the equator, but for the 
level of resolution you want out of shading this doesn't seem 
unreasonable.
Regards
Gordon
-- 
Gordon Keith
Programmer/Data Analyst
Marine Acoustics
CSIRO Marine Research
http://www.marine.csiro.au
Heavier-than-air flying machines are impossible.
--Lord Kelvin, president, Royal Society, 1895.
    
    
More information about the grass-user
mailing list