SoilWise Geopackage

Mean Profile pH — QGIS Model

Download the model and its companion style to reproduce the workflow exactly and ensure consistent symbology in QGIS.

Warning

Model and style must be co‑located. The model file and its corresponding style file must reside in the same folder. If either file is moved or the directory structure changes, relative references will break and the style will not be applied at >runtime/build time.

1) Objective

This document describes a QGIS model that computes the mean pH per soil plot/profile from Observations by selecting pH datastreams measured with H₂O procedure, normalizing multiple observations per datastream to a group mean, and finally aggregating per plot.

Tip

For further information on model creation and execution, consult the official QGIS documentation for the Model Designer.

2) Expected Inputs

The model works exclusively on the SoilWise GeoPackage and uses the following tables/layers: profileelement, soilprofile, datastream, observation, soilplot. Expected relations: profileelement.ispartof → soilprofile.guid; datastream.guid_profileelement → profileelement.guid; observation.guid_datastream → datastream.guid; soilprofile.location → soilplot.guid.

3) Parameters / Constants

  • Datastream filter (pH in H₂O):
    • guid_observedproperty = '2422dfa9-82a2-4e73-9f63-630d055dcd43' - pH
    • guid_observingprocedure = '43adf8b8-b78c-4ef2-8d78-69e7d8c69d8a' - pHH2O_ratio1-2.5

4) Workflow (condensed)

  1. Select datastreams by observed property & observing procedure (pH + H₂O).
  2. Join soilprofile ↔ profileelement (inner join, discard non‑matching).
  3. Join with selected datastream (inner) and retain the essential fields.
  4. Join with observation to bring result_real and timestamp.
  5. Compute Ph_Obs (Field Calculator):
    • If a guid_3 (datastream) is uniquePh_Obs = result_real.
    • If repeated → assign the mean(result_real) of the group to all rows.
  6. De‑duplicate by guid_3 (one row per datastream).
  7. Statistics by categories (guid;location) over Ph_Obs.
    • Rename the field medianAverage_pH.
  8. Join the statistic back to soilplot.
  9. Apply the style pH_USDA.qml.

5) Output

  • Final layer: soilplot with attribute Average_pH (plot‑level pH) and the pH_USDA.qml style applied.