# Can someone explain the slope calculation algorithm?

Question asked by mzoltak@stanford.edu_Stanford on Sep 12, 2019

In the big picture my plan is to use ArcObjects to rewire the hillshade algorithm to ignore certain areas in a project I'm working on that relies heavily (almost entirely) on elevation data.  Hillshade is calculated from a few different variables but the one I'm stuck on right now is slope.  The same goes for the regular slope calculation tool so let's just talk about that to keep things simple-ish.

ArcGIS says that they calculate slope as follows:

But my concern is the fact that I cannot for the life of my understand why this formula works!  Why are the cells adjacent to "e" multiplied by 2?  Why is everything divided by 8? Is it like an averaging thing or something?  Why on earth does the cell size matter? Is that related to Z-factor (another things I barely understand).

If someone could shed some light on what the heck is going on here I would greatly appreciate that.

Thanks,

Miles