7

Anyone ever have to make a fake hill slope? or a fake digital elevation model (DEM)? What are the best methods for doing so?

For more specifics, suppose I wanted to make a fake hill slope, that was 200m wide by 300m long. If I pick a stating height of 150m and an end height of 100m. How should I go about generating this hill slope? What tools (R, ArcMap, etc...) would be the best method for generating such a hill slope? Do any tools allow for random variation of the elevation values across the DEM (height and width) while still maintaining the slope value (or range of slopes) I am shooting for?

Asked another way, how do I create a 3D surface that is reminiscent of a real hill slope?

WhiteBoxDev's answer below is pretty close to being the answer I am shooting for. My only additional questions relate to randomly altering the elevation of the hill slope (perhaps with a random error?) to make it more realistic - and not perfectly smooth.

11

A good approximation to a 'textbook' hillslope with a convex upper slope, a straight mid-slope, and a concave lower slope would be a sigmoid. The most common sigmoidal function for this type of application would be the logistic function.

enter image description here

A standard form of this function would be:

z = 1 / (1 + e-x)

And here is what it looks like when you model the function as a raster DEM:

enter image description here

EDIT

You asked for further details on how to recreate my image above so here you go:

  1. Run the Assign row or column number to grid cells tool, inputing a base image (with the desired rows and columns), and assigning each grid cell the column number. Call the output grid 'Columns'

  2. Figure out the number of columns in the image (NCOLS, let's say it's 1000 in this example), open the raster calculator, and type in the expression [xVal]=[Columns]/1000*12-6 Press Evaluate. When it's complete, it should automatically display the newly created raster 'xVal'

  3. Now clear the Raster Calculator expression and type this new expression in: [z]=1/(1+Exp([xVal])).

The raster 'z' should look like the image above. If you want it to increase from left-to-right, instead of the right-to-left shown above, simply multiply xVal by -1 in the final equation.

Incidentally, you can use a conditional evaluation to add a scarp face to the slope profile if you like, which would be the equivalent to a piecewise function. The really fun part would be if you needed to add convergent and divergent parts to the slope. And of course, you can mess around with each of the parameters in the equation to position the slope and determine its height. Let me know if you have any questions.

  • can you expand on the steps a little? I can't replicate your results from the pic alone - searching the blog now.... – traggatmot Dec 8 '14 at 1:02
4

Here's one method for accomplishing this in R:

    # Building a fake hillslope
    # This hillslope is 6 rows by 5 columns
    # alter bins / width to alter rows / columns



    x <- seq(-15, 15, by=0.01)


    z <- 1/(1+1.5^-x)            # equation used to generate the shape of the hillslope
    plot(z)

    z <- 150 - (1-z)*5
    plot(z)

    # doing it by loop
    bins <- 6      # could also be considered the length or the hillslope - AKa the number of columns
    elev1 <- numeric(bins)


    for(i in 0:(bins-1))
    {
      begin <- floor( (0 + (length(z)/bins)*i) )
      print(begin)
      end <- floor( ( (length(z)/bins) * (i+1) ) )
      print(end)
      print(mean(z[begin:end]))
      elev1[i+1] <- mean(z[begin:end])  

    }

    plot(elev1, type="l")


    # Making the hillslope wide - AKA creating identical cols
    width <- 5

    # creating empty matric
    hillslope <- matrix(0, nrow=bins, ncol=width)

    #overwriting the matrix with the elevation column
    system.time(
      { 
        for(i in 1:width) 
          hillslope[,i] <- elev1; 
        hillslope <- as.data.frame(hillslope) 
        }
      )



    # applying random error grid - Doesn't really do anything that's helpful
    error <- rnorm((width*bins), mean = 0, sd = 0.05)
    error.matrix <- as.matrix(error, nrow=bins )
    random.hillslope <- as.matrix(hillslope + error.matrix)

    # examining the images 
    image(random.hillslope)
    image(hillslope)
4

Here is a very simple and quick solution to generate a conic hill in R, using the dnormfunction:

library(raster)
a <- matrix(rep(dnorm(1:100, 50, sd = 25)),
            nrow = 100, ncol = 100, byrow = TRUE) 
hill <- raster(a * dnorm(1:100, 50, sd = 25))
plot(hill)

enter image description here

You could also add some variations / heterogeneity with:

hill2 <- hill + rnorm(10000)/100000
plot(hill2)

enter image description here

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.