TransWikia.com

Summary of raster values ​for a region

Geographic Information Systems Asked by Bryan Souza on July 18, 2021

I’m stuck with a problem:

I got three raster’s layers: "Sand", "Clay" and "BD" (Bulk density) of the same region.

How can I obtain a "table" or a "Data frame" with information for the values of the raster’s for each pixel?

I prefer to use QGIS or R.

My main goal is to obtain a lookuptable of this features of the soil:

enter image description here

So i will merge pixels with the same information for Clay, Sand and BD into a unique MU_GLOBAL index.

2 Answers

Do you need to calculate the values of the entire extent of the raster?

if so in QGIS is very easy and fast, you can use expressions and get the global statistics of your raster in a table.

  1. Create a temporary layer, not geometry. Or create a dbf table
  2. In the toolbar there is a button that allows you to add a record.
  3. Open the field calculator, then go to the expressions in the raster option, you will find two options: statistics and value.

We will use the statistics, you can calculate the value:

  • max: maximum
  • min: minimum
  • avg: average
  • stdev: standard deviation
  • range: range
  • sum: sum

An example calculating the average, give a name to the field, define a decimal number, with two or more decimals.

  1. Write and execute the expression:

raster_statistic('BASIN001D8',1,'avg')

In this case, 'CUENCA001D8' is the name of the layer as it appears in the layers panel. The value 1 is the band of the raster layer being queried.

Correct answer by Luis Perez on July 18, 2021

Using R, you could do something like:

# Assuming the raster layers are geotiff format
library(raster)
rast_list = c(""Sand.tif", "Clay.tif", "BD.tif")
soil_stack = stack(rast_list)
soil_values_df = values(soil_stack)

Although, depending on the size of your region, and resolution, this could be quite inefficient. Not sure what MU_GLOBAL refers to.

Answered by Micha on July 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP