0

I am trying to get a map with the type of soil depending of their texture. I have tried three options:

In SAGA. By using the tool "soil texture classification" where by using three raster with the % of sand, silt and clay it was supposed that I was going to get a map with results between 1 - 12 (http://www.saga-gis.org/saga_tool_doc/2.2.1/grid_analysis_14.html), but what I get it is a map with data between 254 and 255. Nothing to do with the expected result.

In R. There is a package named "soiltexture", but when I try to install it I am giving this message: "ERROR: dependency ‘sp’ is not available for package ‘soiltexture’". I do not know how to fix this issue.

In GRASS. It seems that there is a tool named "r.soils.texture", but I do not have this tool in my grass (QGIS 2.18.15).

So, I do not see more options to be able to get a map of soils by using any of these software.

Has anyone had any of these problems before?

closed as too broad by PolyGeo Jan 29 '18 at 22:59

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    The R problem shouldn't happen. How are you trying to install soiltexture? What version of R are you on? You might want to start a new question on here titled "Problem installing soiltexture R package" with full details. – Spacedman Jan 29 '18 at 14:21
  • I am using RStudio v1.1.383 in Anaconda in Linux. First, I try to instal the package by using install.packages("soiltexture"), it is there when I am given the message: ERROR: compilation failed for package ‘sp’. I tried to install the package "sp" and then I get: ERROR: compilation failed for package ‘sp’, so I got lost... many thanks for your answer. – vacp73 Jan 29 '18 at 14:26
  • Do you have installed sp? Try to install this package first – aldo_tapia Jan 29 '18 at 14:27
  • Well, I have solved the problem of the sp package by installing it by using the command window and with conda instal r-sp. I am working with Anaconda and when I tried to install it in R I got a problem. Now, it seems that it works.... let's see. Many thanks for help. – vacp73 Jan 29 '18 at 14:45
  • As per the Tour please try to always ask one specific question (about one specific GIS product) per question. You can always ask about any others separately. – PolyGeo Jan 29 '18 at 23:00
4

I recommend you to install correctly soiltexture and work in R. You should install it as:

install.packages('soiltexture',dependencies = T)
# or
install.packages('sp'); install.packages('soiltexture',dependencies = T)

After this, here you have a basic example:


Dummy data:

library(raster)
library(soiltexture)

r <- raster()
clay <- setValues(r,values = rnorm(n = ncell(r),mean = 30,sd = 1))
silt <- setValues(r,values = rnorm(n = ncell(r),mean = 30,sd = 1))
sand <- setValues(r,values = rnorm(n = ncell(r),mean = 40,sd = 1))

st <- stack(clay,silt,sand)

st_sum <- calc(st, fun = sum)

# data normalization

normSt <- list()

for (i in seq(3)) {
  normSt[[i]] <- st[[i]]/(st_sum/100)
}

normSt <- stack(normSt)

rasterVis::levelplot(normSt)

enter image description here

Convert rasters to data.frame, calculate soil data and add it back to a raster layer:

df <- as.data.frame(normSt)

names(df) <- c('CLAY','SILT','SAND')

df_classes <- TT.points.in.classes(tri.data = df, class.sys   = "USDA.TT", PiC.type = 't')

df_classes <- as.factor(df_classes)

r[] <- df_classes

rasterVis::levelplot(r)

enter image description here

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