2

I am wondering if there is a way/tool in QGIS (2.6) could produce similar output as ArcGIS "Combine" tool does. I am trying to integrate values from overlapping rasters, and then create a single raster with unique value for each unique combination of input values. If there is a tool in QGIS could be used to get that will be the best. If not, should I using a script to automate reading through each pixel values? I am afraid it will take a large amount of time to processing national-wide data.

Here is the link to document for the "Combine" tool: http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/combine.htm

1

Not tried it myself, but the GRASS algorithm r.stats will give total areas for each combination of cell values in multiple rasters. It seems to available (in 2.16 at least) via Processing.

The output isn't a raster though, it's a table, and it doesn't assign a new category number to each unique combination.

It will save you the trouble working out how to count how many cells have each combination, though. It also allows binning (e.g. aggregating over ranges of values like 0-9, 10-19, 20-29 etc.)

If it's an exact duplicate of the Arc functionality it would certainly be possible using Python and Numpy

  • Hello @Steven, r.stats solved the raster value combination problem for me, although output is not a raster. I am wondering if there is a way to convert the output html to other format such as CSV using Python, so that it could be used for further statistical analysis. – HuH Sep 12 '16 at 18:25
  • @HuH I'm not sure! I think that's worth asking as a new question. Maybe include a screenshot of the output window, and mention the QGIS version again? There have been a lot of changes in Processing recently, certainly since 2.6. – Steven Kay Sep 12 '16 at 20:45
0

There may be a better way to do this - but this is what I did: * For this you have to use Grass, R and GeoAlgorithm Scripts. NOTE: There is a SAGA -> Raster analysis -> Cross-classification and tabulation tool - but this does not produce accurate results....so don't use it unless you know what you are doing... Here are the steps:

  • First in Grass, use: r.cross (Select 2 rasters as inputs) and save cross product output file to say, -> xtab.tif NOTE: The combination of inputs are lost in Qgis because it cannot import grass categories into Tiff (no raster attribute table).

  • For xtab.tiff, apply Qgis geoalgorithm script -> "Generate unique values style" (You can download this from Processor Toolbox -> Scripts -> Tools -> Get scripts from on-line scripts collection) Also, for xtab.tiff count the cells in each unique value -> "Unique values count" and save output as xtabunq.csv (qgis_unique_count.py)

  • In order to find out what combinations of input rasters result in these unique values, go to R scripts Processor Toolbox -> R Scripts -> Tools -> Create new R script and add the foll:

Qgis-R code

  • Run the R script and save R output as xtab.csv

  • Now, compare and "match" the cell counts in xtab.csv and xtabunq.csv to find out the what input combinations resulted in xtab.tif values...

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.