8

I'm trying to create something like a cellular automaton land cover change model using QGIS, in which cells randomly change land cover based on probabilities determined from various input rasters. I've already have a map of probabilities of conversion, and I need to take the next step.

I found this question, Randomly altering raster map of habitat types?, which looks very similar to what I want to do. The suggested approach is to use a Markov chain or probabilistic cellular automaton, and the commenter writes: "The transitions can be implemented using Map Algebra statements, which makes this method practicable in any raster-based GIS, even those without direct or quick access to cell-level data."

Can anybody tell me how to do probabilistic map algebra in QGIS or one of its extensions? I don't see any probability tools in the Raster Calculator.

Failing that, is there a tool that will simply generate random rasters to be later combined using the Raster Calculator?

4
  • I'm going to look into Curlew's suggestion. In the meantime, one alternative is the GRASS tools r.random and r.random.cells via the SEXTANTE plugin. The annoying part about this approach is that you need to specify the number of cells to distribute randomly, so if what you're going for is a probability you basically need to take your desired probability and multiply it by the number of cells in your raster. Not ideal. Commented Nov 13, 2013 at 18:49
  • Also notice my edit, specifically this one: gis.stackexchange.com/questions/60562/…. You could probably adapt the code for use inside QGIS
    – Curlew
    Commented Nov 13, 2013 at 18:51
  • QGIS uses GRASS for raster calculations. GRASS includes several random-raster procedures such as r.random.surface. It has plenty of statistical calculations, more than are needed to do this work: see the manual.
    – whuber
    Commented Nov 13, 2013 at 20:00
  • Whuber, I don't think r.random.surface is quite right for what I want. I'm not looking for a distribution so much as a random on-off based on a predetermined probability. The r.random and r.random.cells tools look closer if I'm understanding this correctly... Commented Nov 13, 2013 at 20:06

3 Answers 3

6

I don't know of any cellular automaton tools integrated in QGIS yet, but if you just wanna generate a distributional based random raster based on a number of inputs (similar to this ArcGis function) then you could use the "Create random landscape" tool i implemented in the QGIS Plugin LecoS.

Example output (of a random raster with Gaussian distribution):

enter image description here

Many more distributions are available. The plugin can be started from within the Processing toolbox. Read more here.


I will try to look more into generating a cellular automaton landscape as soon as i have free time available.


EDIT Have you seen this answer? You could probably adapt the R-code for your needs and make it even loadable in QGIS-processing.

6
  • Thanks... I just enabled LecoS. Do your tools need to be installed separately? I don't see an option for "Create random landscape". Help me out? Commented Nov 13, 2013 at 18:56
  • Ohh, its inside the Processing Toolbox (QGIS Version > 2.0). If it isn't visible, try to enable it inside the Procssing toolbox options (providers -> check/uncheck activate).
    – Curlew
    Commented Nov 13, 2013 at 18:59
  • I'm seeing Landscape modifications (Clean small pixels in patches, Close holes in patches, Extract patch edges, Increase/Decrease patches, Isolate smallest/greatest patches); Landscape polygon overlay (Overlay metrics); and Landscape statistics (Landscape wides statistics, Patch statistics)... Commented Nov 13, 2013 at 19:02
  • Which QGIS and LecoS version are you using? The functions mentioned in my blogpost are only available for the current QGIS stable (and newer) and since LecoS 1.9. I fear in order to use them you have to update to QGIS Dafour
    – Curlew
    Commented Nov 13, 2013 at 19:07
  • 1
    If you're using QGIS 2.0 and newer than just update the LecoS plugin through the plugin manager or download it from here: plugins.qgis.org/plugins/LecoS (to be placed inside your profile folder)
    – Curlew
    Commented Nov 13, 2013 at 19:15
2

One solution that works:

  • Use GRASS function r.surf.random to create raster of cells with random value withing a defined range (this gives a uniform distribution)
  • Use Raster Calculator to determine values less than or equal to desired probability value (scaled for magnitude of range)
  • Repeat as needed
1

With the release of QGIS 3.14 you will be able to use the native Create random raster algorithms in the processing toolbox for generating random rasters. There are different random value distributions you can choose from besides the standard uniform random distribution:

  1. Binomial random distribution
  2. Exponential random distribution
  3. Gamma random distribution
  4. Negative binomial random distribution
  5. Normal random distribution
  6. Poisson random distribution
  7. Uniform random distribution

The uniform random distribution also exposes parameters to generate random value rasters between given boundary values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.