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?

  • 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. – user1521655 Nov 13 '13 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 Nov 13 '13 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 Nov 13 '13 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... – user1521655 Nov 13 '13 at 20:06

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.

  • 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? – user1521655 Nov 13 '13 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 Nov 13 '13 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)... – user1521655 Nov 13 '13 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 Nov 13 '13 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 Nov 13 '13 at 19:15

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

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.