[Qgis-user] “Equal to frequency”
Benjamin Ducke
benducke at fastmail.fm
Tue May 15 07:19:01 PDT 2018
If it's a small number of rasters then you can use
the GRASS provider and 'r.mapcalc'. But if you want
to compare more than one raster with a base raster,
then you will need to call 'r.mapcalc' multiple
times to get a cumulative result.
The 'if()' expression(*) will be your friend.
Sth. like this:
if(ValRas==InRas1,OutRas=OutRas+1,OutRas)
(raster names match illustration on ArcGIS help page:
http://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/equal-to-frequency.htm)
For a larger number of 'InRasN' rasters, you would need
to add some logical 'ands' (&&), and run computations
_iteratively_:
if(ValRas==InRas1,OutRas=OutRas+1,OutRas)
if((ValRas==InRas1)&&(ValRas==InRas2),OutRas=OutRas+1,OutRas)
...
The tricky part is that 'OutRas' cannot be the output
raster of the GRASS module. It has to be a pre-existing
raster that must be initialized to have '0' in all cells.
You pass that same raster to 'r.mapcalc' at every
iterative run and at the end you have the cumulative
result in 'OutRas'.
Best,
Ben
--
*https://grass.osgeo.org/grass75/manuals/r.mapcalc.html
On 15/05/18 13:48, geoff carver wrote:
> Anyone know how to do the ArcGIS “equal to frequency” function in QGIS???
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
--
Dr. Benjamin Ducke
Deutsches Archäologisches Institut (DAI)
Zentrale Berlin, IT-Referat
* Projekt "Stunde Null" *
More information about the Qgis-user
mailing list