[R-sig-Geo] Proper algorithms for computing slopes for global/polar DEMs?

Javier G. Corripio jgcorripio at mac.com
Sat Feb 21 13:32:18 CET 2015


I think the package raster calculates slope for DEMs in geographic coordinates see ?terrain

If you want a more generic algorithm see Corripio 2003:
http://www.meteoexploration.com/R/insol/data/Corripio03_IJGIS.pdf  It is described for regular grid cells but it is applicable to irregular ones. Insol calculates slope but only for regular squared cells.

If you can neglect curvature of the earth (big IF, but if you can't, slope might be very variable),
for every grid cell in your DEM you can define two vectors, one along longitude and other along latitude to the nearest grid cell point east and north respectively. The distance between points can be calculated with haversine to avoid extra coding (package geosphere), then the vector components would be X=(dx,0,Dzx), Y=(0,dy,Dzy)
dx is distance along parallel of same latitude,
dy is distance along meridian of same longitude,
and Dz is diference in altitude along x or y respectively.

The vector normal to the surface is the vector product N = (X/|X|) x (Y/|Y|), and from the result the slope and aspect can be calculated: slope = acos(Nz)

Javier

> Subject: [R-sig-Geo] Proper algorithms for computing slopes for global/polar DEMs?
> 

-- 
**************************************
Javier G. Corripio, PhD
email: jgcorripio at mac.com
            jgc at meteoexploration.com
url: http://www.meteoexploration.com





	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list