I have a raster height model and would like to calculate the horizontal geographic direction (north, east, etc. - orientation) of each cell, then calculate then the mean value of all these cells in one region (polygon). This is to get information about to what direction a vineyard is exposed to. How do I do this?


The 'direction' you are referring to is known as the aspect of a slope. To calculate this for a raster DEM in QGIS you need to use the Raster > Analysis > DEM (Terrain models) tool which has a mode for aspect. There's a tutorial for working with terrain analysis in the QGIS Training Manual - lesson 8.3.

Once you've generated an aspect raster from your DEM, you can use the Raster Calculator and Zonal Statistics plugin to get the mean aspect value from your regions (zones). As whuber's comment points out this calculation is more complex than it initially sounds, and you can refer to his answer at Sum raster data visible from given point, by proportion of view for full details.

The values generated by the aspect analysis are angular (I believe clockwise from north, but you should confirm that). So if you want a N/E/S/W direction to that, you'll have to determine how fine you want to go (northwest or north-northwest) and then assign it based on the angular value.

| improve this answer | |
  • 2
    Zonal stats, applied directly to aspects, will likely produce some wildly incorrect values. Proper procedures for averaging angular values have to be followed. The correct understanding of mean aspect in this application probably should take into account slope, too, so what is likely needed is the mean normal vector to the slope. Details can be found at gis.stackexchange.com/questions/53664/… and gis.stackexchange.com/questions/7496/… – whuber May 16 '15 at 20:38
  • @whuber You're right, I didn't think that one all the way through. Not only was I making some assumptions based on what the zones were and how small I thought they'd be (which is largely irrelevant), I didn't (don't) fully understand all the math issues and apparently forgot how complicated the angular value thing was; because your comment is ringing bells now. – Chris W May 16 '15 at 20:59

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.