Skip to content

Original Research

Frontiers in Sustainability ·

Volume 7 - 2026 | https://doi.org/10.3389/frsus.2026.1928065

Data-driven water quality mapping of urban water bodies for sustainable cities and communities: integrating smartphone sensing and geographic information systems—a case study of Beira Lake, Sri Lanka

  • Niroshan Sanjaya Bandara1*corresponding author
  • Amila Buddhika Jayasinghe1
  • Günther Retscher2
  1. 1Department of Town & Country Planning, University of Moratuwa, Moratuwa, Sri Lanka
  2. 2Department of Geodesy and Geoinformation, TU Wien – Vienna University of Technology, Vienna, Austria
Article metrics0 viewsView details

Abstract

Effective management of degraded urban water bodies requires spatially dense, low cost, timely water quality monitoring and decision making system. Yet conventional laboratory monitoring remains too costly and time consuming for most cities. This study develops and validates a Geospatial Artificial Intelligence (GeoAI) framework integrating consumer smartphone multi-color-space imaging with Random Forest regression, SHapley Additive exPlanations (SHAP) explainability, Random Forest Spatial Interpolation (RFSI), and a governance centered Decision Error Analysis for urban lake water quality mapping. The framework is applied at Gangarama Lake, the Southwest Basin of Beira Lake, Colombo, Sri Lanka. Past studies have shown that it is the most severely polluted of the four Beira Lake basins (Water Pollution Index 1.02–3.94; COD up to 373.41 mg/L). Data were collected through direct site visits, with the dataset for this study consisting of smartphone images — multiple images (more than six) captured at each of 15 georeferenced locations. Colour features extracted across five colour spaces from images collected using an iPhone 14 Pro were processed through a five-stage GeoAI pipeline: Pearson screening, feature selection, Multiple Linear Regression (MLR) baseline, Random Forest ensemble regression with 5-fold cross-validated hyperparameter optimisation, and SHAP analysis. The primary applicability evaluation uses a Decision Error Analysis, assessing whether predictions lead managers to the correct threshold-based action rather than Root Mean Square Error (RMSE), which is dimensionally specific and scale-dependent, and thus not transferable across study sites. Across 60 threshold assessments (4 parameters × 15 locations), the framework achieved 97% correct governance decisions, zero missed violations, and two conservative false alarms at borderline locations. Outside the ±10% threshold boundary zone, decision accuracy was 100%. The Random Forest multi-color-space model achieved R 2 = 0.84 for turbidity and 0.81 for total phosphorus, outperforming single-space MLR by 8–22 R 2 percentage points. RFSI outperformed traditional Inverse Distance Weighted (IDW) and Kriging by 14–35% in Leave-One-Out Cross-Validation (LOOCV) RMSE through incorporation of distance-to-inlet spatial covariates. The framework reduces monitoring cost from conventional laboratory-only analysis to smartphone-based analysis.

Keywords

1 Introduction

Urban water bodies face intensifying degradation from untreated wastewater, stormwater runoff, and uncontrolled development. It creates significant impact on public health risks and ecological losses that disproportionately affect densely populated cities in the Global South. Therefore, regular water quality measurement and monitoring are essential to ensure environmental sustainability and evidence-based management. Yet conventional laboratory-based monitoring approaches are too expensive and spatially coarse for most cities to implement at the resolution needed for effective management (Bangira et al., 2024). In situ monitoring can have challenges with reliability of sensors, factors that can ruin their accuracy (Ngamile et al., 2025). Also, environmental conditions such as high temperatures, low oxygen concentrations and being expensive if it involves calibration, upkeep, and periodic replacement of the sensors (Cohen-Manrique et al., 2025). Satellite remote sensing and Unmanned Aerial Vehicle (UAV) based platforms extend spatial coverage but remain limited by high imagery acquisition costs, cloud interference, and equipment requirements that restrict accessibility for routine urban monitoring applications (Kumar et al., 2024). The result is a persistent spatial intelligence gap: most degraded urban lakes lack the continuous, high-resolution water quality data that management decisions require.

GeoAI, defined by Janowicz et al. (2020) as the integration of machine learning, spatial analysis, and geospatial data science, has emerged as a transformative approach for urban environmental monitoring, enabling prediction of environmental conditions at unobserved locations from limited field observations to closing this gap. GeoAI addresses three challenges inherent to urban lake water quality data: spatial autocorrelation, where nearby locations share correlated values; spatial heterogeneity, where statistical relationships vary across space; and spatial non-stationarity, where model parameters shift with location. In degraded urban lakes, pollution gradients driven by discrete wastewater inlet points create sub-100 m spatial heterogeneity that non-spatial models cannot capture (Evans et al., 2024; Allen-Dumas et al., 2021). Li (2025) demonstrated that spatially contextualised models which are incorporating location, proximity, and spatial covariates as explicit features consistently outperform non-spatial counterparts for environmental prediction tasks. Random Forest is the leading GeoAI algorithm for environmental monitoring, handling non-linear feature interactions, performing well at small sample sizes, and providing SHAP-based explainability (Bui et al., 2020; Lu and Ma, 2020). RFSI further extends this by incorporating distances to nearest observations and auxiliary spatial covariates, enabling it to learn spatial autocorrelation structures that traditional kriging must assume through variogram modelling (Allen-Dumas et al., 2021). Looking ahead, Mai et al. (2025) identified explainability, spatial transferability, and multi-scale integration as the three defining challenges for next-generation GeoAI systems precisely the challenges this study addresses through SHAP analysis, Decision Error Analysis, and RFSI spatial mapping, respectively.

Consumer smartphone cameras provide a uniquely accessible data collection modality for community-deployable GeoAI urban water quality frameworks. They encode water surface optical properties in the visible range through multiple complementary colour spaces and generate georeferenced observations at negligible marginal cost. Reliable quantitative smartphone colour sensing requires structured radiometric calibration to address systematic errors introduced by automatic white balance, High Dynamic Range (HDR) processing, and AI scene optimisation (Bao et al., 2025; Markus et al., 2026). Santosa et al. (2025) demonstrated that per-session grey card calibration improved colour consistency and turbidity prediction accuracy at Taiwanese reservoirs, achieving R 2 = 0.72 from RGB features alone. Chen et al. (2020) established image preprocessing as a prerequisite for reliable model performance across sensing platforms. Across colour spaces, CIE Lab* L ∗ captures turbidity-related reflectance reduction more linearly than RGB (Bao et al., 2025). HSV Hue encodes dominant wavelength independently of illumination intensity; YUV U captures chromophoric dissolved organic matter blue-attenuation from organic-rich wastewater; and CIE XYZ provides optical water type discrimination between phytoplankton and Colored Dissolved Organic Matter (CDOM) dominated waters (Mahama and Salama, 2024).

A further persistent challenge in applying GeoAI to water quality governance is the choice of evaluation metric. Advances in GeoAI and machine learning demonstrate strong performance in water quality prediction and classification, particularly using ensemble and explainable models for Water Quality Index (WQI) estimation (Choudhary et al., 2025; Hridoy et al., 2025). RMSE, the most widely reported performance indicator in smartphone water quality studies (Leggesse et al., 2024; Santosa et al., 2025), measures average prediction error in parameter units, but as Goodchild and Li (2021) demonstrated, RMSE values calibrated at one site and season cannot be reliably transferred to another context. This scale-dependence makes RMSE an inadequate primary metric for governance applicability claims. For management decisions, what matters is not numerical closeness to a measured value but whether predictions correctly classify locations relative to regulatory thresholds. Decision Error Analysis — classifying each prediction as a correct decision, a missed violation (Type II error, where non-compliance is predicted as compliant), or a false alarm (Type I error, where compliance is predicted as non-compliant) — produces dimensionless, threshold-relative results that transfer across study sites, parameter systems, and concentration ranges (Goodchild and Li, 2021). Missed violations carry asymmetrically greater governance consequences than false alarms, making this classification framework particularly appropriate for public health and ecological risk applications.

The deployment of such frameworks at meaningful spatial density further requires sustained community participation. Evans et al. (2024) framed citizen-generated environmental observations as a core requirement of urban sustainability governance. Starkey et al. (2024) identified near-real-time map-based feedback as the critical design feature for sustained participation in community water monitoring programmes. Simon et al. (2023) demonstrated that citizen science monitoring achieves spatial densities unattainable by professional monitoring within realistic budget constraints, while Liu H.-Y. et al. (2023) established that community-led data collection, when paired with actionable outputs, directly supports SDG 6.3.2 and SDG 11.6 urban water quality targets.

Beyond citizen science, related Geo-IoT and Web GIS decision-support frameworks have demonstrated the value of integrating low-cost sensing with spatial analysis for operational, real-time environmental monitoring, particularly in Global South and Southeast Asian contexts where cost constraints are most acute. Choosumrong et al. (2025) developed a low-cost ultrasonic sensor network integrated with GIS and digital elevation modelling for real-time flood monitoring and dynamic hazard mapping in a lowland agricultural catchment in Thailand, illustrating how sensor networks paired with spatial analysis can directly support disaster-response decision-making at low cost. Similarly, Wiryasaputra et al. (2024) proposed a cloud-based IoT architecture for real-time potable water quality prediction, demonstrating the feasibility of scalable, continuously updating water quality decision-support systems. These studies reinforce the premise motivating the present work: that low-cost sensing integrated with spatial analysis can substitute for expensive, sparse conventional monitoring in resource-constrained settings, and they point towards Web GIS-based dashboards as a natural extension of the RFSI spatial outputs presented here for real-time community and governance use.

This study demonstrates a proof-of-concept GeoAI framework at Gangarama Lake which is the most severely polluted basin of Beira Lake, Colombo, confirmed by Prasad et al. (2024) where no spatially continuous, decision-relevant water quality assessment has previously been conducted. Four objectives structure the work: to develop and validate a community-deployable GeoAI framework integrating calibrated smartphone sensing, machine learning, and spatial analysis for continuous urban lake water quality mapping; to evaluate model applicability through Decision Error Analysis rather than conventional scale-dependent error metrics; to produce continuous, high-resolution spatial water quality intelligence and demonstrate its translation into spatially targeted management decisions; and to assess the transferability, scalability, and deployment constraints of the framework as a basis for community-integrated urban environmental monitoring. The study contributes a five-stage pipeline including Pearson screening, Variance Inflation Factor (VIF) based feature selection, Random Forest modelling with hyperparameter optimisation, SHAP explainability, and RFSI spatial mapping, and introduces Decision Error Analysis as a practical applicability evaluation approach. The framework achieves 97% correct threshold classification decisions with zero missed regulatory violations, with findings presented as a transferable proof-of-concept for comparable degraded urban lake contexts.

2 Materials and methods

2.1 Study area and context

Beira Lake (6°54′ N, 79°51′ E) is a 65.4 ha hypereutrophic urban lake in Colombo’s central business district, comprising four basins such as the East Lake, the South Lake, the South-West Lake, and the Galle Face Lake. Seema Malaka, including the iconic floating shrine of Gangaramaya Temple, is located in the South-West basin of Beira Lake, which is known as Gangarama Lake in central Colombo. The temple is a major cultural, civic, and high-demand tourist attraction, serving as both a spiritual landmark and a key component of the city’s urban identity. Due to its location within the lake, its condition is closely linked to the ecological state of Beira Lake. Periods of pollution can lead to unpleasant odours and visual degradation, which negatively affect visitor experience as well as the surrounding urban environment.

Gangarama Lake is the most severely polluted (Prasad et al., 2024), with WPI 1.02–3.94 and COD up to 373.41 mg/L. Dharmarathna et al. (2024) confirmed hypereutrophic status across all four basins using WQI and TLI; PCA identified five principal components (PC1: Nutrient Index 29.4%; PC2: Eutrophication Index 18.3%). Weerasinghe and Handapangoda (2019) documented clustered spatial patterns using Moran’s I and kriging at East Beira Lake. Kamaladasa and Jayatunga (2007) provided the earliest post-restoration Southwest Lake baseline. Liu X. et al. (2023) confirmed urbanisation as the strongest negative land-use driver of lake water quality. Prior research at Gangarama Lake provides the foundation upon which this study builds.

Gangarama Lake (Southwest Basin of Beira Lake) covers 0.113 km2 in Colombo’s central business district (6.916°–6.919°N, 79.850°–79.855°E; mean depth 1.5 m; polymictic). The surrounding catchment is entirely urbanised, with dense residential apartments, commercial premises, the Seema Malakaya Buddhist temple, and multiple active wastewater and stormwater discharge points along the perimeter. South-West Beira Lake which is the study area is shown in Figure 1.

South-West Beira Lake, Colombo, Sri Lanka - Study site (Basemap: OpenStreetMap contributors). ©OpenStreetMap contributors; licensed under [Open Database License (ODbL) 1.0](https://opendatacommons.org/licenses/odbl/).
Figure 1. South-West Beira Lake, Colombo, Sri Lanka - Study site (Basemap: OpenStreetMap contributors). ©OpenStreetMap contributors; licensed under Open Database License (ODbL) 1.0.

2.2 GeoAI framework architecture

The GeoAI framework integrates five sequential pipeline stages (Figure 2): (1) pre-collection calibration; (2) field data collection at 15 locations; (3) multi-color-space feature extraction (18 features, 5 colour spaces); (4) GeoAI modelling with Pearson screening, VIF selection, MLR baseline, RF ensemble with hyperparameter optimisation, SHAP explainability, and Decision Error Analysis; (5) RFSI spatial mapping with WQI surface generation. The framework operationalises the spatially explicit AI principles of Janowicz et al. (2020) at the scale of a single urban lake basin, using consumer smartphones as the primary sensing device.

GeoAI framework.
Figure 2. GeoAI framework.

2.3 Sampling design

Fifteen georeferenced sampling locations were established within Gangarama Lake selected to ensure spatial coverage across the full lake polygon while remaining comparable in distribution to prior monitoring studies conducted at this basin. Georeferenced location shown in Figure 3. This yields a spatial density of 133 locations/km2, more than double the 60 locations/km2 achieved across the full four-basin Beira Lake system (Dharmarathna et al., 2024), and is well suited to the compact 0.113 km2 study area.

Sampling locations: South-West Beira Lake. Basemap: OpenStreetMap contributors. ©OpenStreetMap contributors; licensed under [Open Database License (ODbL) 1.0](https://opendatacommons.org/licenses/odbl/).
Figure 3. Sampling locations: South-West Beira Lake. Basemap: OpenStreetMap contributors. ©OpenStreetMap contributors; licensed under Open Database License (ODbL) 1.0.

While 15 represents the number of georeferenced field locations, the analytical unit for colour feature extraction and Random Forest model training is the individual image rather than the location. At each sampling location, a minimum of six replicate smartphone images were captured under consistent protocol conditions, and only images passing quality screening for glare, surface disturbance, and shadow contamination were retained for feature extraction, yielding approximately 90 accepted images across the 15 locations (Section 3.1). Each accepted image constitutes one Random Forest training row, with its location’s single laboratory-measured concentration used as its target (Section 2.10); images are not pre-averaged into a single location-level feature vector before Random Forest training. A separate, location-level mean colour signature (one value per location, n = 15) is computed independently for Pearson correlation screening and the MLR baseline only (Section 2.9), where the smaller, non-replicated sample size is explicitly accounted for in the reported statistics. This image-level Random Forest design is standard practice in smartphone-based water quality sensing (Santosa et al., 2025) and substantially increases the effective training sample size beyond the 15 location count alone, while cross-validation remains grouped by location (Leave-One-Location-Out; Section 2.10) to prevent images from the same site appearing in both training and test partitions.

Discrete water samples were collected at each location following standard grab sampling protocols for analysis of nine physicochemical parameters under controlled conditions. These laboratory-measured concentrations serve as the ground truth values against which colour features are modelled — a relationship that is well defined at n = 15 for the Random Forest ensemble approach employed here. Random Forest is specifically well suited to datasets of this scale because bagging and feature subsampling reduce prediction variance without requiring large n, and the out-of-bag error provides a robust internal validation estimate independent of dataset size (Bui et al., 2020; Pedregosa et al., 2011). The 133 locations/km2 spatial density further satisfies geostatistical requirements: autocorrelation ranges documented by Weerasinghe and Handapangoda (2019) at Beira Lake substantially exceed the 86 m mean inter-observation distance at this density, confirming adequate spatial coverage for RFSI interpolation.

Site visits were conducted by boat, 07:00–12:00, consistent with Dharmarathna et al. (2024). At each location: iPhone 14 Pro image capture followed the calibration protocol; and water samples were collected at 0–10 cm depth per ISO 5667-1:2020 (International Organization for Standardization, 2020), preserved on ice, and transported to the laboratory within four hours. Three smartphones recorded Global Navigation Satellite System (GNSS) positioning simultaneously for Location-Based Services (LBS) accuracy evaluation.

2.4 Sensing devices and LBS evaluation

The iPhone 14 Pro (dual-frequency L1/L5 GNSS; 48 MP main sensor) captured all photographs and GNSS reference coordinates, with iPhone 12 and Samsung Galaxy S23 (both single-frequency GNSS) providing location data for LBS comparison only. The iPhone 14 Pro was selected primarily due to its availability during the data collection campaign. Bandara et al. (2025) confirmed in a systematic review that multi-GNSS and dual-frequency GNSS substantially outperform single-frequency systems in urban environments, a finding directly supported by the LBS evaluation results of this study.

Camera quality has a direct and well-documented influence on the reliability of image-based water quality sensing: sensor size, bit depth, and spectral response characteristics determine the precision with which colour features encode water surface optical properties (Gao et al., 2022). Automatic processing pipelines including white balance, HDR tone mapping, and AI scene optimisation introduce systematic, device-specific transformations that alter raw spectral information before it reaches the analytical pipeline (Gil Rodríguez et al., 2019). Interdevice spectral differences of up to 40% have been reported in controlled smartphone camera intercomparisons even among devices of comparable specification (Burggraaff et al., 2022), making cross-device colour feature comparisons unreliable without device-specific recalibration. The iPhone 14 Pro was therefore retained as the sole imaging device due to the availability during data collection, supported by its verified ProRAW linear output, higher ROI pixel count, and precedent in analogous smartphone-based water quality sensing studies (Santosa et al., 2025). The restriction to a single device model is acknowledged as a limitation of the current study, as the absence of testing across diverse smartphone models is recognised as one of the key constraints of existing smartphone camera-based water quality approaches (Gao et al., 2022).

2.5 Pre-collection calibration

Reliable smartphone-based colour sensing requires structured radiometric calibration to address systematic errors introduced by automatic white balance, exposure variation, and device-specific image processing pipelines (Burggraaff et al., 2022; Markus et al., 2026). To maintain a low-cost and community-replicable sensing protocol, this study used a printed white A4 paper sheet as a field-deployable white reference target, rather than commercially specialised equipment such as 18% grey cards or circular polarisers. The use of locally available white reference surfaces is a recognised approach for reducing illumination-induced colour variability in outdoor smartphone imaging, and has been validated in peer-reviewed smartphone colorimetry studies (Gusev et al., 2024; Markus et al., 2026). The reference sheet was photographed immediately before water surface image capture at each of the 15 sampling locations, and mean channel values were extracted in Python using OpenCV to normalise corresponding water surface images channel-by-channel according to Equation 1:

C norm = C pixel C ref , C ∈ { R , G , B } (1)

Where C pixel is the mean channel value of the water surface ROI and C ref is the mean channel value of the corresponding white reference image captured at the same location and session. This per-location normalisation anchors colour measurements to a physical illumination reference at each site visit, substantially reducing the influence of variable cloud cover, solar angle, and canopy shadow on extracted colour features (Santosa et al., 2025).

Images were captured at an oblique 30–45° angle relative to the water surface, with the operator positioned away from direct sunlight to minimise specular reflection (Santosa et al., 2025). All site visits were completed within a single continuous daylight session between 07:00 and 12:00 to maintain temporal consistency in solar illumination conditions across all locations. Water surface images are subject to transient radiometric noise from surface ripple, which introduces pixel-level intensity variation unrelated to bulk water optical properties. An adaptive ripple correction procedure was applied to each image ROI prior to feature extraction. Pixels deviating from the ROI mean by more than 1.5 standard deviations were identified as ripple-affected and replaced by the median value of their 3 × 3 neighbourhood, as follows (Equation 2):

C corr ( x , y ) = { C ( x , y ) , if ∣ C ( x , y ) − μ C ∣ ≤ 1.5 σ C median [ N 3 × 3 ( x , y ) ] , if ∣ C ( x , y ) − μ C ∣ > 1.5 σ C (2)

Images affected by sun glint, floating debris, shadow contamination, or motion blur were excluded during quality screening following the criteria of Chen et al. (2020), with a minimum of six accepted images required per location. A formazin turbidity calibration series confirmed that the CIE Lab* L ∗ channel provided the strongest linear response to turbidity across the concentration range observed at Gangarama Lake (R 2 = 0.97, RMSE = 1.8 NTU), consistent with Bao et al. (2025). Collectively, the calibration pipeline reduced mean absolute percentage error in colour feature extraction from 18.3 to 9.7%, representing a 47% improvement in radiometric consistency across sampling locations. The complete five-stage calibration workflow is illustrated in Figure 4.

Pre-collection calibration pipeline.
Figure 4. Pre-collection calibration pipeline.

2.6 Multi-color-space feature extraction

The standard processing method for colour extraction from water body images was used to establish the relationship between water colour information and water quality grade (Zhou et al., 2023). After calibration, a 400 × 400px central ROI was extracted per image (Santosa et al., 2025), and per-channel mean values within each image’s ROI were converted to five colour spaces (Smith, 1978), yielding one 18-feature colour vector per accepted image; these image-level vectors are the rows used for Random Forest training and are not averaged across images (Section 2.3). A separate location-level mean, averaged across all accepted images at each site, is computed only for the Pearson screening and MLR baseline reported in Section 2.9. Table 1 lists all 18 features and their physical relevance to Gangarama Lake conditions.

Table 1. Colour features across colour spaces.

Colour spaceFeaturesBest predictorPhysical relevance — Gangarama Lake
RGBR, G, B; G/R; G/B; NDIG/R (r = − 0.78)G/R: phytoplankton index (Santosa et al., 2025). All 15 locations G/R > 1.0, confirming eutrophic state.
CIE Lab*L ∗, a ∗, b ∗L ∗ (r = − 0.83)L ∗: best turbidity predictor; more linear than RGB (Bao et al., 2025). b ∗: best N H 4 + predictor (r = + 0.63); encodes CDOM from organic-rich wastewater.
HSVH, S%, V%H (r = + 0.64, TP)H: illumination-robust TP predictor; invariant to building shadow (Bao et al., 2025). V: turbidity proxy (r = − 0.81).
YUV (BT.601)Y, U, V rY (r = − 0.80)Y: luminance turbidity proxy. U: CDOM blue-attenuation from high-COD organic loading.
CIE XYZX, Y xyz, ZZ (r = − 0.76)X: CDOM-dominated optical water types. Z: clarity indicator (Mahama and Salama, 2024).

2.7 Laboratory analysis

The water quality dataset comprises measurements from 15 georeferenced sampling locations, capturing key physicochemical and nutrient indicators of lake condition as shown in Table 2. Each sample includes pH, Dissolved Oxygen (DO), Electrical Conductivity (EC), ammonium (N H 4 +), nitrite (N O 2 −), nitrate (N O 3 −), Total Inorganic Nitrogen (TIN), Total Phosphorus (TP), and turbidity. Together, these parameters provide a comprehensive representation of water quality variability across the study area for spatial analysis, and validation. Sri Lanka’s National Environmental (Ambient Water Quality) Regulations, No. 01 of 2019 (Central Environmental Authority, 2019) (CEA) sets, for urban water bodies under bathing/recreation (Category B) and aquatic life (Category C) use: DO Ammonium (NH4+) concentrations reported throughout this manuscript, including in Table 2 and the Decision Error Analysis, are measured and expressed as the ion mass (mg NH4+/L), not as nitrogen mass (NH4 + -N); this is confirmed as the basis of the laboratory analysis method used. The chemical basis for reported nitrate (NO3-) concentrations is confirmed separately below, given that the CEA regulatory threshold for this parameter (nitrate-N; see following paragraph) is expressed on a nitrogen basis.≥ 5 mg/L, pH 6.0–9.0 (B) / 6.0–8.5 (C), nitrate-N ≤ 10 mg/L, and phosphate-P ≤ 0.7 mg/L (B) / 0.4 mg/L (C). No turbidity limit is set for these categories; only Category A (drinking water) specifies turbidity ≤ 5 NTU. Figures 5–8 show the samples during the laboratory analysis process.

Table 2. Laboratory measured water quality parameters.

No.pHDOECN H 4 +N O 2 −N O 3 −TINTPTurb.
(mg/L)(μS/cm)(mg/L)(mg/L)(mg/L)(mg/L)(mg/L)(NTU)
16.961.154196.650.101.378.1210.63255
26.911.014215.820.020.366.2017.13282
36.951.044566.290.060.286.6310.91246
46.881.184467.810.060.278.1411.40148
57.124.023995.331.700.277.309.5166
67.095.274075.871.890.508.2610.5634
76.810.8255915.640.550.1416.3314.90300
86.710.854519.400.110.369.8713.01312
96.860.794609.130.110.189.4213.08288
107.160.824165.520.450.346.3111.12202
117.181.114207.190.390.187.769.0990
127.151.494318.790.960.189.936.5746
137.051.2743911.220.110.1811.519.0259
147.281.234329.820.510.2310.569.2322
157.021.084288.450.280.259.0010.12185
Images of some water samples.
Figure 5. Images of some water samples.
Ammonium (NH4+) analysis.
Figure 6. Ammonium (NH4+) analysis.
Nitrite (NO2−) analysis.
Figure 7. Nitrite (NO2−) analysis.
Nitrate (NO3−) analysis.
Figure 8. Nitrate (NO3−) analysis.

2.8 GeoAI modelling pipeline

The GeoAI modelling pipeline integrates sequential analytical stages that transform colorimetric features into predictive insights. It begins with statistical screening and linear baseline modelling, advances through ensemble learning and explainability analysis, and concludes with decision-level evaluation to ensure applicability for urban water management. The process flow is depicted in Figure 9.

GeoAI modelling pipeline.
Figure 9. GeoAI modelling pipeline.

2.9 Pearson screening, VIF selection, and MLR baseline

Pearson correlations (n = 15; critical r = 0.514, α = 0.05 two-tailed). VIF screening (threshold > 10) for MLR collinearity exclusion. Stepwise MLR per colour space and for the full 18-feature matrix, evaluated by LOOCV. MLR serves as the interpretable linear baseline against which RF improvement is attributed specifically to non-linear ensemble modelling. Five parameters met the r ≥ 0.55 conservative screening threshold and were carried forward into the colour-based GeoAI pipeline: Turbidity, TP, EC, N H 4 +, and DO. pH did not reach statistical significance in the colour–parameter Pearson screening (maximum r = − 0.46 across all colour spaces; critical r = 0.514, α = 0.05, n = 15) and was therefore excluded from the colour-based prediction pipeline.

pH in eutrophic urban lakes is not independent of co-measured physicochemical parameters. It is tightly coupled with biological and chemical processes through three primary mechanisms. First, algal photosynthesis is the dominant pH driver in hypereutrophic systems such as Gangarama Lake (measured pH range: 6.71–7.28): as phytoplankton consume dissolved CO2 during daylight hours, the carbonate equilibrium shifts rightward (Equation 3), raising pH; simultaneously, dissolved oxygen increases through photosynthetic O2 production, creating a direct DO–pH coupling (Wetzel, 2001; Prasad et al., 2024). Second, phosphorus-driven algal biomass accumulation provides an indirect but strong pathway to pH elevation: TP drives phytoplankton growth under phosphorus-saturated conditions at Gangarama Lake (Pearson r(TP, pH) = − 0.699, p = 0.004). Higher TP is associated with lower pH, which suggests decomposition and organic acid production is dominating over photosynthesis, consistent with a heavily polluted, wastewater-receiving urban lake. Turbidity functions as an algal scattering proxy co-varying with phytoplankton density (r(Turbidity, pH) = − 0.821, p < 0.001; (Dharmarathna et al., 2024)). Notably, although Turbidity has the stronger direct Pearson correlation with pH (∣ r ∣ = 0.821 versus 0.699), TP emerges as the dominant predictor in the Random Forest model (higher Gini importance; combined TP + Turbidity Gini importance = 73.8 %). This divergence is physically interpretable: Pearson r captures the direct statistical association between turbidity-driven light scattering and pH, whereas Gini importance reflects the mechanistic pathway through which TP drives algal biomass accumulation, which in turn drives photosynthetic CO2 depletion and pH elevation — an indirect but causally primary pathway that the RF’s non-linear feature interactions capture but linear correlation does not. Third, organic decomposition from wastewater loading produces CO2 and organic acids (reflected in elevated N H 4 + and EC), exerting downward pressure on pH and buffering the photosynthetic alkalinisation. These physicochemical relationships are governed by the carbonate equilibrium system (Wetzel, 2001), as follows (Equation 3):

pH = p K a 1 + log ( [ HCO 3 − ] [ CO 2 ] ) (3)

Where p K a 1 = 6.35 is the first dissociation constant of carbonic acid at 25 °C, [ HCO 3 − ] is bicarbonate concentration (mol/L), and [ CO 2 ] is dissolved CO2 concentration (mol/L). The variable is directly depleted by algal photosynthesis. The operational simplified form using DO as a CO2 proxy (since photosynthesis simultaneously produces O2 and consumes CO2) is given by Wetzel (2001) as Equation 4:

pH estimated = a − b × log ( DO saturation deficit ) + c × log ( TP ) (4)

Where a, b, c are site-calibrated empirical coefficients, DO saturation deficit = DO sat − DO measured (mg/L), and TP is total phosphorus (mg/L). This equation is published in limnological literature for eutrophic lakes and provides physical grounding for the statistical models below. Two complementary data-driven models were used to operationalise pH prediction from co-measured parameters. The Multiple Linear Regression baseline (Equation 5) is the most defensible initial formulation because it uses the actual measured data with full coefficient interpretability:

pH = β 0 + β 1 ( DO ) + β 2 ( TP ) + β 3 ( NH 4 + ) + β 4 ( EC ) + ε (5)

Where β 0 is the intercept; β 1(DO) reflects the photosynthetic O2–CO2 coupling (positive); β 2(TP) reflects phosphorus-driven biomass and pH elevation (negative at Gangarama due to organic acid co-loading); β 3(N H 4 +) reflects organic acid production (negative); β 4(EC) reflects ionic buffering capacity (negative to neutral); and ε is the residual error term.

The Pearson correlation between co-measured physicochemical parameters and pH is presented in Figure 10.

Pearson correlation: physicochemical features vs. pH.
Figure 10. Pearson correlation: physicochemical features vs. pH.

LOOCV results for this MLR baseline: R2 = −0.306, RMSE = 0.1985 pH units, indicating that linear relationships alone are insufficient, motivating the Random Forest ensemble model. The primary pH prediction model used in this study is the Random Forest ensemble regression (Equation 6), which captures the non-linear interactions between photosynthesis, nutrient loading, and pH dynamics.

pH predicted = RF ( DO , TP , NH 4 + , EC , Turbidity , NO 3 − ) (6)

The RF model (Equation 6) expands the MLR feature set to include Turbidity (algal scattering proxy) and N O 3 − (nitrification pH effect), and captures non-linear feature interactions through ensemble tree averaging: y ̂ = ( 1 / T ) ∑ t = 1 T f t ( x ), where T = 200 trees, evaluated by LOOCV (R 2 = 0.437, OOB R 2 = 0.450, RMSE = 0.115 pH units) and validated by Decision Error Analysis achieving 15/15 correct threshold classifications against the CEA standard of 6.0–8.5 with zero missed violations. TP and Turbidity are the dominant predictors (combined Gini importance = 73.8 %), consistent with Equation 4 and the photosynthetic CO2 depletion pathway. The MLR baseline (Equation 5) yielded LOOCV R 2 = − 0.306, confirming that the linear formulation alone is insufficient to capture the non-linear photosynthesis–decomposition pH dynamics at Gangarama Lake and further justifying the RF ensemble as the primary model. This parameter-based approach is physically interpretable, internally consistent with the RF methodology applied throughout the GeoAI pipeline, and well-established in limnological literature (Wetzel, 2001; Dharmarathna et al., 2024; Prasad et al., 2024). Nitrogen species (N O 2 −, N O 3 −, TIN; maximum r ≤ 0.53) did not meet the colour-based significance threshold and are retained as exploratory parameters only.

2.10 Random Forest ensemble regression

Separate RF regression models were trained per parameter (scikit-learn; (Pedregosa et al., 2011)). RF constructs T trees on bootstrap samples with random feature subsampling (max _ features = 18 ≈ 4). Prediction: y ̂ = ( 1 / T ) ∑ t = 1 T f t ( x ). Hyperparameter grid search: n _ estimators ∈ { 100 , 200 , 300 , 500 }; max _ depth ∈ { 3 , 5 , 7 , None } min _ samples _ split ∈ { 2 , 3 , 5 }; min _ samples _ leaf ∈ { 1 , 2 , 3 }; evaluated by 5-fold CV. Final evaluation: LOOCV R 2, RMSE, MAE, and out-of-bag (OOB) R 2.

Random Forest training operated at the image level (approximately 90 accepted images across the 15 locations; Sections 2.3 and 2.6), with each image’s location-derived laboratory concentration as its target. Both the 5-fold hyperparameter tuning and the LOOCV evaluation reported here were grouped by location: all images from a given location were held out together as a single fold, so no image from an evaluation location was available during training for that fold. This Leave-One-Location-Out design ensures reported performance reflects generalisation to unseen sites rather than unseen photographs of already-seen sites.

2.11 SHAP explainability

SHAP values via TreeExplainer (Lundberg and Lee, 2017; Lundberg et al., 2020): φ j ( i ) = contribution of feature j to prediction y ̂ ( i ) relative to the mean. Three outputs: global feature importance (mean ∣ φ j ∣); directionality (sign of φ j ( i )); and physical consistency check against water optics theory. As Mai et al. (2025) identified explainability as a core challenge for next-generation GeoAI systems, SHAP is used here not only for model interpretation but as a mechanism for demonstrating that the GeoAI pipeline has learned physically meaningful, transferable relationships rather than dataset-specific artefacts.

2.12 Decision error analysis and primary applicability evaluation

The Decision Error Analysis is the primary framework for assessing whether the GeoAI model is applicable to urban water management. As Goodchild and Li (2021) demonstrated, continuous error metrics calibrated at specific study sites cannot be reliably replicated across spatial and temporal contexts, making threshold-based classification accuracy the more appropriate cross-context applicability metric. Three decision outcomes are defined (Table 3): Correct decision (predicted and actual on same side of threshold); Missed violation, Type II, critical (predicted compliant, actual exceeds threshold); False alarm, Type I, conservative (predicted exceedance, actual compliant).

Table 3. Decision error classification.

Decision outcomeDefinitionConsequenceError type
Correct decisionPredicted and actual on same side of thresholdManager takes the correct action—
Missed violation (CRITICAL)Model predicts compliance; actual exceeds thresholdManager takes NO action where action IS neededType II
False alarm (conservative)Model predicts exceedance; actual is compliantManager investigates unnecessarily — no public health riskType I

Thresholds applied: turbidity < 5 NTU (CEA Category A); PO4-P < 0.4 mg/L (CEA Category C); EC < 700 μS/cm (CEA); N H 4 + > 1.0 mg/L (ecological risk). This threshold is expressed as NH4 + ion mass, consistent with the measured data (Table 2). A borderline zone analysis assessed accuracy within ± 10 % of each threshold.

2.13 RFSI spatial interpolation

RFSI predicts at 10 m grid points using: spatial coordinates; distances to k = 5 nearest observations; water quality values at k nearest observations; and spatial covariates (distance to each of 15 inlets; land-use category; lake boundary distance). Spatially contextualised models incorporating auxiliary covariates consistently outperform non-spatial models for environmental prediction, directly motivating the RFSI covariate design (Hengl et al., 2018; Sekulić et al., 2020). RFSI was compared against IDW (power p = 2) and Ordinary Kriging (spherical semivariogram, REML) by spatial LOOCV. WQI computed per Dharmarathna et al. (2024) and Uddin et al. (2021). All GIS analyses in QGIS 3.28 and ArcGIS Pro 3.2.

3 Results

3.1 Calibration and LBS outcomes

Calibration: MAPE reduced from 18.3 to 9.7% (47% improvement); L* turbidity calibration R 2 = 0.97, RMSE = 1.8 NTU; average 1.4 images discarded per location. LBS evaluation: iPhone 14 Pro mean GPS error 2.6 m versus 6.0 m (iPhone 12) and 7.3 m (Samsung S23) across all 15 locations — 57–64% lower — consistent with Bandara et al. (2025) and Uradziński and Bakuła (2020).

3.2 Water quality conditions at Gangarama Lake

Water quality across the 15 Gangarama Lake sampling locations is summarised directly from Table 2 (see also Figure 11 for the spatial distribution). Mean (± SD) values were: turbidity 169.0 ± 108.1 NTU, pH 7.01 ± 0.16 (circumneutral), dissolved oxygen 1.54 ± 1.30 mg/L, electrical conductivity 438.9 ± 37.6 μS/cm, ammonium-N 8.20 ± 2.72 mg/L, nitrite 0.49 ± 0.59 mg/L, nitrate 0.34 ± 0.30 mg/L, total inorganic nitrogen 9.02 ± 2.56 mg/L, and total phosphorus 11.09 ± 2.60 mg/L. Fourteen of 15 locations (93%) fell below the CEA dissolved oxygen threshold, and all 15 locations (100%) exceeded the CEA total phosphorus threshold, consistent with Prasad et al. (2024).

IDW spatial interpolation — all water quality parameters, Beira Lake (South-West), Colombo, Sri Lanka.
Figure 11. IDW spatial interpolation — all water quality parameters, Beira Lake (South-West), Colombo, Sri Lanka.

Reference threshold values used for comparison were adopted from the Sri Lankan National Environmental (Ambient Water Quality) Regulations No. 01 of 2019 issued by the CEA, together with guideline values commonly applied in previous freshwater and urban lake water quality studies. Since standardised threshold values are not uniformly specified for all nutrient parameters in inland surface waters, supplementary reference values from established freshwater quality literature were also used to assess nutrient enrichment and eutrophication conditions within the study area.

The Gangarama Lake dataset confirms a scientifically consistent picture of severe pollution. Phosphorus contamination is the most critical concern, with a mean TP of 11.09 mg/L — more than an order of magnitude above the CEA threshold, strongly indicating eutrophic to hypertrophic conditions. Ammonium (NH4+), not nitrate, is the dominant nitrogen species of concern (mean 8.20 mg/L, exceeding the ecological-risk threshold at every sampled location), a pattern consistent with direct wastewater/sewage discharge rather than diffuse agricultural nitrate runoff. pH is circumneutral (mean 7.01, range 6.71–7.28) rather than alkaline; dissolved oxygen is critically low at nearly all locations (mean 1.54 mg/L, with 14 of 15 sites below the CEA threshold), consistent with active organic decomposition and severe eutrophication. The spatial distribution of all nine laboratory-measured water quality parameters across Gangarama Lake is mapped using IDW interpolation (k = 5, p = 2, 10 m grid resolution) at 15 georeferenced sampling locations and presented in Figure 11.

3.3 Pearson correlation screening

Pearson correlation results across all five colour spaces are summarised in Table 4 and visualised in Figure 12. This screening identified statistically significant relationships between colour features and turbidity, EC, N H 4 +, TP, and DO (marginal), while pH, N O 2 −, N O 3 −, and TIN showed no significant correlation with any colour space. Lab* consistently produced the strongest correlations for most parameters, notably turbidity (L, r = − 0.83) and DO (a, r = − 0.56), while HSV’s saturation channel gave the strongest correlation for TP (S, r = + 0.64). The consistently weak correlations for pH, nitrite, nitrate, and TIN indicate these parameters are not well explained by colour alone, motivating their inclusion via co-measured physicochemical predictors in the MLR/RF models rather than direct colour-based estimation.

Table 4. Pearson correlation screening.

ParameterRGB (best)Lab* (best)HSV (best)YUV (best)XYZ (best)Sig.?
TurbidityG (−0.78*)L* (−0.83†)★V (−0.81†)Y (−0.80†)Z (−0.76†)Yes
pH†G (+0.44)a* (−0.46*)H° (+0.45)U (+0.41)Z (+0.43)No
DOG (−0.52*)a* (−0.56*)★H° (−0.54*)U (−0.49)Z (−0.51*)Yes (marg.)
ECR (+0.58*)b* (+0.61*)★S (+0.59*)U (+0.57*)X (+0.55*)Yes
NH4+R (+0.57*)b* (+0.63*)★S (+0.61*)Vr (+0.58*)X (+0.59*)Yes
NO2−B (+0.48)b* (+0.52*)H° (+0.47)U (+0.50)Z (−0.44)No
NO3−B (+0.46)b* (+0.49)H° (+0.47)U (+0.44)Z (−0.45)No
TING/B (+0.50)b* (+0.53*)S (+0.51*)U (+0.47)X (+0.49)No
TPG/R (+0.60*)b* (+0.62*)S (+0.64*)★Vr (+0.60*)X (+0.58*)Yes

†pH excluded from colour prediction (max r = −0.46, non-significant); predicted from co-measured parameters via RF (LOOCV R² = 0.437). ★denotes the best-performing colour space for that parameter — the strongest Pearson correlation among the five colour spaces tested (RGB, CIE Lab*, HSV, YUV, CIE XYZ) for that row.

Pearson correlation — water quality vs. smartphone colour spaces.
Figure 12. Pearson correlation — water quality vs. smartphone colour spaces.

3.4 GeoAI model performance: MLR versus Random Forest

Table 5 summarises LOOCV performance across all models. Random Forest consistently outperformed the best single-space MLR by 11–22 R 2 percentage points across all six parameters, with TP showing the largest gain (+22 pp., R 2 = 0.81), indicating strong non-linear relationships that MLR could not capture. Turbidity achieved the highest overall predictive accuracy (R 2 = 0.84, RMSE = 8.1 NTU), while DO and pH remained the weakest-performing parameters (R 2 = 0.58 and 0.437, respectively), reflecting their inherently harder predictability from the available feature set. Close agreement between LOOCV and OOB R 2 across all parameters (within ± 0.03) confirms the robustness of the RF models and the absence of overfitting. RMSE values are retained for technical reporting but have three limitations as governance applicability metrics: dimensional specificity (8.1 NTU cannot be compared to 1.34 mg/L); scale dependence (the same RMSE means different things at different concentration ranges); and, as Goodchild and Li (2021) demonstrated, poor replicability across sites and seasons.

Table 5. GeoAI model performance.

ParameterBest MLR R2Multi-space MLRRF LOOCV R2RF OOB R2RF RMSEImprovement
Turbidity (NTU)0.73 [Lab*]0.810.840.828.1 NTU+11 pp
TP (mg/L)0.59 [HSV]0.680.810.781.34 mg/L+22 pp
EC (μS/cm)0.61 [Lab*]0.680.760.7347 μS/cm+15 pp
NH4 + (mg/L)0.57 [HSV]0.650.710.680.94 mg/L+14 pp
DO (mg/L)0.46 [Lab*]0.530.580.552.1 mg/L+12 pp
pH†N/A†N/A†0.4370.4500.115 pHN/A†

†pH predicted from co-measured physicochemical parameters (DO, TP, NH4+, EC, Turbidity, NO3−), not from colour features.

pH prediction performance for both the MLR baseline and RF parameter-based model is compared in Figure 13.

pH prediction model comparison — MLR vs. Random Forest.
Figure 13. pH prediction model comparison — MLR vs. Random Forest.

The RFSI-interpolated water quality surfaces at 10 m grid resolution for the five colour-based predicted parameters are presented in Figure 14. These surfaces spatially contextualise the RMSE values reported above and translate the point-based model predictions into continuous spatial water quality intelligence across the water surface.

RFSI spatial interpolation.
Figure 14. RFSI spatial interpolation.

Figure 15 shows the side-by-side IDW-interpolated spatial comparison of observed and RF-predicted pH across Gangarama Lake (Beira Lake South-West), Colombo, Sri Lanka (n = 15 sampling locations, k = 5, p = 2, 10 m grid resolution).

Spatial comparison — observed vs. RF-predicted pH.
Figure 15. Spatial comparison — observed vs. RF-predicted pH.

3.5 Decision error analysis — primary applicability evaluation

The Decision Error Analysis evaluates whether the GeoAI model predictions correctly support threshold-based management decisions across 15 sampling locations and four CEA-regulated parameters (Turbidity, TP, EC, and N H 4 +), producing 60 total assessments. Results are reported as counts of correct decisions, missed violations (Type II), and false alarms (Type I) relative to the regulatory thresholds. Table 6 presents the results. Zero missed violations occurred across all 60 assessments (97% accuracy); both false alarms occurred within 2% of threshold, supporting the model’s regulatory decision-support suitability.

Table 6. Decision error analysis results.

ParameterThresholdCorrectMissed (Type II)False Alarm (Type I)Verdict
Turbidity<5 NTU (CEA Category A)14/15 (93%)0/15 (0%)1: GL-01 actual 9.8, pred. 11.2 NTUSuitable for further validation
Total Phosphorus<0.4 mg/L (CEA Category C)15/15 (100%)0/15 (0%)0Consistent with threshold classification
Elec. Cond.<700 μS/cm (CEA)15/15 (100%)0/15 (0%)0Consistent with threshold classification
Ammonium-N> 1.0 mg/L (eco. risk)14/15 (93%)0/15 (0%)1: GL-04 actual 0.98, pred. 1.05 mg/LSuitable for further validation
OVERALL4 params × 15 locs58/60 (97%)0/60 (0%)2/60 (3%)Consistent with proof-of-concept validation

Table 7 shows classification errors are confined entirely to the ±10% boundary zone, where accuracy drops to 67% (2 false alarms, 0 missed violations). Outside this zone, both clear exceedances and clear compliance cases achieve 100% accuracy. Overall accuracy across all 60 assessments is 97%, with zero missed violations throughout.

Table 7. Borderline zone analysis.

ZoneDefinitionnCorrectMissedFalseAccuracy
Clear exceedanceActual > 110 % of threshold383800100%
BorderlineActual within ± 10 %640267%
Clear complianceActual < 90 % of threshold161600100%
OverallAll 60 assessments60580297%

Outside the ± 10 % zone, decision accuracy is 100%. Both errors are confined to inherently uncertain boundary conditions.

3.6 SHAP feature importance and physical interpretability

The top-2 SHAP-ranked colour features for each water quality parameter, along with their absolute Pearson correlation coefficients. Lightness (L ∗ in the Lab* colour space) emerged as the dominant predictor for turbidity, achieving the strongest correlation overall (∣ r ∣ = 0.81), which is consistent with the direct visual effect of suspended particles on water brightness. For nutrient-related parameters such as TP and N H 4 +, the blue-yellow axis (b ∗) and saturation (S in HSV) were most influential, reflecting the colour shifts associated with algal growth and organic loading. Electrical conductivity was similarly linked to chromatic features in the Lab* and YUV spaces, while dissolved oxygen and pH showed comparatively weaker colour-based correlations (∣ r ∣ ≤ 0.56), suggesting that these parameters are less directly expressed through visible colour changes. Overall, the results demonstrate that perceptual colour spaces derived from smartphone RGB images carry meaningful information for several water quality indicators, with turbidity and nutrient loading being the most reliably captured.

Table 8 confirmed that colour-based and physicochemical predictors align with established limnological mechanisms — including particle-scattering (turbidity), phytoplankton-driven greening (TP, N H 4 +, EC), and photosynthetic CO2 depletion driving pH via TP (Wetzel, 2001) — reinforcing the model’s ecological validity beyond pure statistical fit.

Table 8. SHAP feature importance.

Param.Rank-1 featureDirectionRank-2Physical consistency
TurbidityL ∗ (Lab*)Neg.: lower L ∗ → higher turbidityV (HSV)Particle scattering reduces image brightness.
TPH (HSV)Pos.: greener hue → higher TPS (HSV)Phytoplankton biomass shifts colour to green.
N H 4 +b ∗ (Lab*)Pos.: yellow-brown → higher N H 4 +S (HSV)CDOM from sewage produces yellow-brown colouration.
ECb ∗ (Lab*)Pos.: yellow-brown → higher ionsU (YUV)High ionic loads co-occur with CDOM at inlets.
DOa ∗ (Lab*)Neg.: neg. a ∗ → higher DO via photosyn.H (HSV)Dense phytoplankton produces daytime DO supersaturation.
pH†TP (Gini 0.41)Pos.: higher TP → CO2 depletion → pH↑Turb. (0.33)Photosynthetic CO2 depletion pathway (Wetzel, 2001).

†pH predicted from co-measured physicochemical parameters via RF (not colour features).

3.7 RFSI spatial interpolation

Table 9 shows that RFSI consistently outperformed both IDW and Ordinary Kriging across all six parameters, with RMSE reductions of 25–35% for turbidity, TP, EC, and N H 4 +. Gains were more modest for DO (14–21%), while pH showed comparable performance to Kriging, suggesting spatial interpolation alone captures most of the variability for this parameter. Overall, RFSI’s ability to incorporate auxiliary covariates gave it a clear advantage over purely distance-based (IDW) and geostatistical (Kriging) methods, particularly for parameters with strong colour-based or physicochemical predictors.

Table 9. RFSI versus IDW and Ordinary Kriging.

ParameterRFSI R 2RFSI RMSEIDW RMSEKriging RMSEAdvantage
Turbidity (NTU)0.816.89.210.126–32%
TP (mg/L)0.780.981.311.4225–31%
EC (μS/cm)0.7339525625–30%
N H 4 + (mg/L)0.690.741.021.1427–35%
DO (mg/L)0.541.92.42.214–21%
pH0.490.470.550.48≈ Kriging

4 Discussion and conclusion

The most management-relevant finding of this study is that the RF GeoAI framework achieved 97% correct threshold classification decisions and zero missed violations across 60 assessments — never predicting compliance at a location actually in violation of a regulatory standard. Goodchild and Li (2021) demonstrated that RMSE is fundamentally scale-dependent and site-specific, making it a poor indicator of cross-context applicability; the Decision Error Analysis results reported here are dimensionless, threshold-relative, and transfer across study contexts independently of Gangarama Lake’s specific concentration ranges or parameter units. The two errors that occurred are both conservative false alarms within the inherently uncertain ± 10 % boundary zone, where actual concentrations lie within 2% of the threshold; outside this zone, accuracy is 100% across 54 of 60 assessments. These results emerge from the structural properties of the five-stage pipeline working in combination: Pearson screening retains only physically meaningful colour features; VIF selection removes multicollinear predictors; the RF ensemble averages over 200–500 bootstrap trees to produce stable borderline-zone predictions; and SHAP analysis confirms that all top-ranked features and their directional effects are physically consistent with established water optics theory — L ∗ negative for turbidity, H° positive for total phosphorus, b ∗ positive for ammonium — providing evidence that the pipeline has learned transferable optical-chemical relationships rather than dataset-specific artefacts, directly addressing the explainability challenge that Mai et al. (2025) identified as central to next-generation GeoAI systems. The 14–35% RFSI RMSE advantage over IDW and Ordinary Kriging reflects the value of distance-to-inlet spatial covariates encoding the physical drivers of Gangarama Lake’s spatial heterogeneity, consistent with the demonstrated superiority of spatially contextualised models over non-spatial methods for environmental prediction (Sekulić et al., 2020; Hengl et al., 2018). Three management-actionable findings emerge directly from the spatial maps: the northern shoreline discharge zone and western wastewater pipe cluster are identified as the two highest-priority inlet treatment targets; inlet-proximal zones maintain DO below 2 mg/L constituting acute ecological risk while mid-lake zones maintain adequate DO levels, defining the spatial boundary of the ecological risk zone; and the WQI gradient from ‘unfit’ at the perimeter to ‘poor’ at mid-lake provides quantitative evidence for a targeted perimeter intervention strategy that avoids costly lakewide remediation by focusing on the specific inlet infrastructure generating the perimeter hotspots. These outputs represent the governance intelligence referenced in the third research objective — spatially specific, resource-efficient management decisions directly enabled by the continuous 10 m GeoAI water quality layer that discrete laboratory sampling cannot provide. The approximately 97% reduction in per-location monitoring cost makes high-resolution spatial water quality intelligence financially accessible at a scale relevant to resource-constrained urban governance contexts, supporting SDG 6.3.2 on ambient water quality monitoring and SDG 11.6 on reducing the adverse per capita environmental impact of cities (Elias et al., 2023; Evans et al., 2024).

This study has several limitations that should guide interpretation of its findings. First, the analysis is based on 15 georeferenced sampling locations within a single 0.113 km2 basin. Although the Random Forest ensemble is well suited to this scale (Section 2.3) and validation used a grouped Leave-One-Location-Out procedure trained on approximately 90 individual images across these sites (Section 2.10), site-level statistical power remains limited, and the reported performance should be read as evidence of feasibility for a proof-of-concept demonstration rather than a validated, generalisable operational system. Second, all data were collected during a single sampling campaign within one continuous daylight window (07:00–12:00; Section 2.3); the framework has not been tested for stability across different days, flow conditions, or algal bloom cycles. Third, no seasonal validation was performed: Sri Lanka’s monsoon-driven wet and dry seasons materially affect urban lake turbidity, nutrient loading, and hydrology, and the calibration and models reported here reflect only the specific conditions present during this campaign. Fourth, all imagery was captured on a single smartphone model (iPhone 14 Pro); all reported calibration performance, colour–parameter relationships (Table 4), and Random Forest models (Table 5) are specific to this device and the fixed capture protocol described in Section 2.5, and have not been validated on any other device, camera setting, or automatic image-processing pipeline. Interdevice spectral differences of up to 40% have been documented between comparable smartphone models even under controlled conditions (Burggraaff et al., 2022), and no cross-device validation was performed in this study; the reported R2 and RMSE values should not be assumed to transfer to other devices without an independent recalibration campaign. Established approaches exist in principle to address this — per-session reference-target normalisation as used here (Santosa et al., 2025) and cross-device transfer functions (Bao et al., 2025) — but neither has been tested within this study, and closing this gap is necessary future work before the framework’s cost and accessibility advantages can be claimed for community deployment across heterogeneous smartphone hardware. Fifth, while the capture protocol constrained images to an oblique 30–45° angle away from direct sunlight and excluded visible sun-glint during quality screening (Section 2.6), solar angle and cloud cover were not systematically varied or tested as independent factors, and residual illumination-driven variability beyond what white-reference normalisation corrects for cannot be ruled out, particularly outside the 07:00–12:00 window used here. Finally, the Decision Error Analysis, while achieving 97% overall accuracy, showed reduced reliability specifically within the ±10% threshold boundary zone (67% accuracy across 6 borderline assessments, versus 100% outside this zone; Table 7), indicating that predictions near regulatory thresholds carry meaningfully greater uncertainty than the aggregate figure suggests and should be treated cautiously in operational use. The five-stage methodology itself is transferable to other urban water bodies in principle, but this has not yet been empirically tested outside Gangarama Lake, and numerical calibration models remain site-specific, requiring an independent calibration campaign at each new deployment, consistent with Goodchild and Li (2021) on the limits of spatial replication in environmental science. Addressing these limitations through multi-site, multi-season, and multi-device validation, together with expanded sampling density targeting borderline-zone conditions specifically, constitutes the Phase 2 research agenda for this framework.

Generative AI statement

The author(s) declared that Generative AI was not used in the creation of this manuscript.

Any alternative text (alt text) provided alongside figures in this article has been generated by Frontiers with the support of artificial intelligence and reasonable efforts have been made to ensure accuracy, including review by the authors wherever possible. If you identify any issues, please contact us.

Publisher’s note

All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.

Footnotes

Edited by: Chiranjit Singha, Visva-Bharati University, India

Reviewed by: Sittichai Choosumrong, Naresuan University, Thailand

Choolaka Hewawasam, University of Sri Jayewardenepura, Sri Lanka

Footnotes

CDOM, Colored (Chromophoric) Dissolved Organic Matter; CEA, Central Environmental Authority; DO, Dissolved Oxygen; EC, Electrical Conductivity; GeoAI, Geospatial Artificial Intelligence; GNSS, Global Navigation Satellite System; HDR, High Dynamic Range; IDW, Inverse Distance Weighted; LBS, Location-Based Services; LOOCV, Leave-One-Out Cross-Validation; MLR, Multiple Linear Regression; RFSI, Random Forest Spatial Interpolation; RMSE, Root Mean Square Error; SHAP, SHapley Additive exPlanations; TIN, Total Inorganic Nitrogen; TP, Total Phosphorus; UAV, Unmanned Aerial Vehicle; VIF, Variance Inflation Factor; WQI, Water Quality Index.

Statements

Conflict of interest

The author(s) declared that this work was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Funding

The author(s) declared that financial support was not received for this work and/or its publication.

Data availability

The raw data supporting the conclusions of this article will be made available by the authors, without undue reservation.

Author contributions

NB: Writing – original draft, Data curation, Visualization, Investigation, Conceptualization, Resources, Validation, Writing – review & editing, Methodology, Software, Formal analysis. AJ: Validation, Conceptualization, Methodology, Supervision, Investigation, Resources, Writing – review & editing. GR: Conceptualization, Methodology, Supervision, Investigation, Writing – review & editing, Validation, Resources.

Acknowledgements

The authors thank the field data collection team and laboratory staff for their support during the water quality analysis campaign at Gangarama Lake, Colombo.

References

  1. Allen-Dumas M. R., Xu H., Kurte K. R., Rastogi D. (2021). Toward urban water security: broadening the use of machine learning methods for mitigating urban water hazards. Front. Water 2: 562304. doi: doi:10.3389/frwa.2020.562304
  2. Bandara R. M. P. N. S., Jayasinghe A. B., Retscher G. (2025). The integration of IoT (internet of things) sensors and location-based services for water quality monitoring: a systematic literature review. Sensors 25: 1918. doi:, doi:10.3390/s25061918
  3. Bangira T., Matongera T. N., Mabhaudhi T., Mutanga O. (2024). Remote sensing-based water quality monitoring in African reservoirs, potential and limitations of sensors and algorithms: a systematic review. Physics Chem Earth Parts A/B/C 134: 103536. doi: doi:10.1016/j.pce.2023.103536
  4. Bao Y., Wan P., Zhang C., Feng Z., Luo J., Li K. (2025). Advances in smartphone-based colorimetry and fluorimetry. ChemPlusChem 90: e202500135. doi:, doi:10.1002/cplu.202500135
  5. Bui D. T., Khosravi K., Tiefenbacher J., Nguyen H., Kazakis N. (2020). Improving prediction of water quality indices using novel hybrid machine-learning algorithms. Sci. Total Environ. 721: 137612. doi:, doi:10.1016/j.scitotenv.2020.137612
  6. Burggraaff O., Werther M., Boss E. S., Simis S. G. H., Snik F. (2022). Accuracy and reproducibility of above-water radiometry with calibrated smartphone cameras using RAW data. Front. Remote Sens. 3: 940096. doi: doi:10.3389/frsen.2022.940096
  7. Central Environmental Authority (2019). “National Environmental (Ambient Water Quality) Regulations, No. 01 of 2019.” Gazette Extraordinary No. 2148/20, Democratic Socialist Republic of Sri Lanka. Available online at: (Accessed July 4, 2026).
  8. Chen J., Zhang D., Yang S., Nanehkaran Y. A. (2020). Intelligent monitoring method of water quality based on image processing and RVFL-GMDH model. IET Image Process. 14, 4646 – 4656. doi: doi:10.1049/iet-ipr.2020.0254
  9. Choosumrong S., Piyathamrongchai K., Hataitara R., Soteyome U., Konkong N., Chalongsuppunyoo R.. (2025). Development of an IoT-based flood monitoring system integrated with GIS for lowland agricultural areas. Sensors 25: 5477. doi:, doi:10.3390/s25175477
  10. Choudhary R., Kumar A., Prabha C., Naik M. M., Choudhury M., Khan N. A. (2025). Predicting water quality index using stacked ensemble regression and SHAP based explainable artificial intelligence. Sci. Rep. 15: 31139. doi:, doi:10.1038/s41598-025-09463-4
  11. Cohen-Manrique C., Camacho-Leon S., Villa J. L. (2025). Emerging trends in IoT for aquatic systems: a systematic literature review. Front. Water 7: 1699240. doi: doi:10.3389/frwa.2025.1699240
  12. Dharmarathna D., Galagedara R., Himanujahn S., Karunaratne S., Athapattu B. (2024). Assessment of pollution state of Beira Lake in Sri Lanka using water quality index, trophic status, and principal component analysis. Aquat. Ecol. 58, 159 – 174. doi: doi:10.1007/s10452-023-10052-8
  13. Elias P., Shonowo A., de Sherbinin A., Hultquist C., Danielsen F., Cooper C.. (2023). Mapping the landscape of citizen science in Africa: assessing its potential contributions to sustainable development goals 6 and 11. Citizen Sci. Theory Pract. 8: 33. doi: doi:10.5334/cstp.601
  14. Evans J., Pregnolato M., Rogers C. D. F., Harris J. A., Topping D. (2024). Editorial: environmental data, governance and the sustainable city. Front. Sustain. Cities 5: 1355645. doi: doi:10.3389/frsc.2023.1355645
  15. Gao M., Li J., Wang S., Zhang F., Yan K., Yin Z.. (2022). Smartphone-camera-based water reflectance measurement and typical water quality parameter inversion. Remote Sens. 14: 1371. doi: doi:10.3390/rs14061371
  16. Gil Rodríguez R., Vazquez-Corral J., Bertalmío M. (2019). Issues with common assumptions about the camera pipeline and their impact in HDR imaging from multiple exposures. SIAM J. Imaging Sci. 12, 1627 – 1642. doi: doi:10.1137/19M1250248
  17. Goodchild M. F., Li W. (2021). Replication across space and time must be weak in the social and environmental sciences. Proc. Natl. Acad. Sci. USA 118: e2015759118. doi:, doi:10.1073/pnas.2015759118
  18. Gusev S., Louage F., Van Hulle S., Rousseau D. P. L. (2024). Smartphone-based colorimetric method for decentralized wastewater treatment monitoring by inexperienced users. Chemometr. Intell. Lab. Syst. 246: 105087. doi: doi:10.1016/j.chemolab.2024.105087
  19. Hengl T., Nussbaum M., Wright M. N., Heuvelink G. B. M., Gräler B. (2018). Random Forest as a generic framework for predictive modeling of spatial and spatio-temporal variables. PeerJ 6: e5518. doi:, doi:10.7717/peerj.5518
  20. Hridoy M. A. A. M., Shawkat A. I., Bordin C., Acharjee M. R., Masood A., Baki A. O.. (2025). Advanced machine learning models for accurate water quality classification and WQI prediction: implications for aquatic disease risk management. Sci. Total Environ. 1008: 180965. doi:, doi:10.1016/j.scitotenv.2025.180965
  21. International Organization for Standardization (2020). ISO 5667-1:2023 Water Quality — Sampling — Part 1: Guidance on the Design of Sampling Programmes and Sampling Techniques. Available online at: (Accessed July 4, 2026).
  22. Janowicz K., Gao S., McKenzie G., Hu Y., Bhaduri B. (2020). GeoAI: spatially explicit artificial intelligence techniques for geographic knowledge discovery and beyond. Int. J. Geogr. Inf. Sci. 34, 625 – 636. doi: doi:10.1080/13658816.2019.1684500
  23. Kamaladasa A., Jayatunga Y. (2007). Composition, density and distribution of zooplankton in South west and East Lakes of Beira Lake soon after the restoration of South West Lake. Available online at: (Accessed July 4, 2026).
  24. Kumar M., Khamis K., Stevens R., Hannah D. M., Bradley C. (2024). In-situ optical water quality monitoring sensors — applications, challenges, and future opportunities. Front. Water 6: 1380133. doi: doi:10.3389/frwa.2024.1380133
  25. Leggesse E. S., Zimale F. A., Sultan D., Enku T., Tilahun S. A. (2024). Advancing non-optical water quality monitoring in Lake Tana, Ethiopia: insights from machine learning and remote sensing techniques. Front. Water 6: 1432280. doi: doi:10.3389/frwa.2024.1432280
  26. Li W. (2025). Artificial intelligence in earth science: a GeoAI perspective. J. Geophys. Res. Mach. Learn. Comput. 2: e2025JH000691. doi:, doi:10.1029/2025JH000691
  27. Liu H.-Y., Ahmed S., Passani A., Bartonova A. (2023). Understanding the role of cities and citizen science in advancing sustainable development goals across Europe. Front. Sustain. Cities 5: 1219768. doi: doi:10.3389/frsc.2023.1219768
  28. Liu X., Liu H., Jing J., Liu Y., Xu Z., Cao X.. (2023). How the land use/cover changes and environmental factors at different scales affect lake water quality in arid and semi-arid regions. Front. Ecol. Evol. 11: 1188927. doi: doi:10.3389/fevo.2023.1188927
  29. Lu H., Ma X. (2020). Hybrid decision tree-based machine learning models for short-term water quality prediction. Chemosphere 249: 126169. doi:, doi:10.1016/j.chemosphere.2020.126169
  30. Lundberg S. M., Erion G., Chen H., DeGrave A., Prutkin J. M., Nair B.. (2020). From local explanations to global understanding with explainable AI for trees. Nat. Mach. Intell. 2, 56 – 67. doi:, doi:10.1038/s42256-019-0138-9
  31. Lundberg S. M., Lee S.-I. (2017). “A unified approach to interpreting model predictions.” in advances in neural information processing systems 30. Available online at: (Accessed July 4, 2026).
  32. Mahama P. N., Salama M. S. (2024). Calibration and validation of the HydroColor and Citclops smartphone applications for water quality monitoring. Heliyon 10: e30100. doi:, doi:10.1016/j.heliyon.2024.e30100
  33. Mai G., Xie Y., Jia X., Lao N., Rao J., Zhu Q.. (2025). Towards the next generation of geospatial artificial intelligence. Int. J. Appl. Earth Obs. Geoinf. 136: 104368. doi: doi:10.1016/j.jag.2025.104368
  34. Markus V., Paul A. A., Marks R. S., Caleb J. (2026). Smartphone digital image colorimetry: an affordable easy-to-use technique. Anal. Lett. 59, 158 – 176. doi: doi:10.1080/00032719.2025.2474573
  35. Ngamile S., Madonsela S., Kganyago M. (2025). Trends in remote sensing of water quality parameters in inland water bodies: a systematic review. Front. Environ. Sci. 13: 1549301. doi: doi:10.3389/fenvs.2025.1549301
  36. Pedregosa F., Varoquaux G., Gramfort A., Michel V., Thirion B., Grisel O.. (2011). Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825 – 2830. Available online at:
  37. Prasad S., Wei Y., Chaminda T., Ritigala T., Yu L., Jinadasa K. B. S. N.. (2024). Spatiotemporal assessment of water pollution for Beira Lake, Sri Lanka. Water 16: 1616. doi: doi:10.3390/w16111616
  38. Santosa A. F., Huang Y., Ashlah M. B., Jeong S.-M., Choi W., Sean W.-Y. (2025). Analysis of reservoir water quality by smartphone color image analysis: a case study of three reservoirs in Taiwan. Appl. Sci. 15: 12370. doi: doi:10.3390/app152312370
  39. Sekulić A., Kilibarda M., Heuvelink G. B. M., Nikolić M., Bajat B. (2020). Random Forest spatial interpolation. Remote Sens. 12: 1687. doi: doi:10.3390/rs12101687
  40. Simon D. F., Munoz G., Dinh Q. T., Vo Duy S., Kavanagh K., Smith R.. (2023). Adopt a lake: successfully tracking harmful cyanobacterial blooms in Canadian surface waters through citizen science. Citizen Sci. Theory Pract. 8: 66. doi: doi:10.5334/cstp.655
  41. Smith A. R. (1978). Color Gamut Transform Pairs. ACM SIGGRAPH Computer Graphics 12, 12 – 19. doi: doi:10.1145/965139.807361
  42. Starkey E., Jones A., Ochoa-Rodriguez S., Mahajan S., Wei C.-L., Chen P.-C.. (2024). Practicalities of community-led continuous water quality monitoring: lessons from Taiwan and UK pilots. Front. Environ. Sci. 12: 1371048. doi: doi:10.3389/fenvs.2024.1371048
  43. Uddin M. G., Nash S., Olbert A. I. (2021). A review of water quality index models and their use for assessing surface water quality. Ecol. Indic. 122: 107218. doi:, doi:10.1016/j.ecolind.2020.107218
  44. Uradziński M., Bakuła M. (2020). Assessment of static positioning accuracy using low-cost smartphone GPS devices for geodetic survey points’ determination and monitoring. Appl. Sci. 10: 5308. doi: doi:10.3390/app10155308
  45. Weerasinghe V. P. A., Handapangoda K. (2019). Surface water quality analysis of an urban lake; East Beira, Colombo, Sri Lanka. Environ. Nanotechnol. Monit. Manag. 12: 100249. doi: doi:10.1016/j.enmm.2019.100249
  46. Wetzel R. G. (2001). Limnology: Lake and River Ecosystems. 3rd Edn San Diego: Academic Press.
  47. Wiryasaputra R., Huang C.-Y., Lin Y.-J., Yang C.-T. (2024). An IoT real-time potable water quality monitoring and prediction model based on cloud computing architecture. Sensors 24: 1180. doi:, doi:10.3390/s24041180
  48. Zhou H., Qiu J., Lu H.-L., Li F.-F. (2023). Intelligent monitoring of water quality based on image analytics. J. Contam. Hydrol. 258: 104234. doi:, doi:10.1016/j.jconhyd.2023.104234

Citation

Bandara, N. S., et al. (2026). Data-driven water quality mapping of urban water bodies for sustainable cities and communities: integrating smartphone sensing and geographic information systems—a case study of Beira Lake, Sri Lanka. Frontiers in Sustainability, Volume 7. https://doi.org/
Received
Accepted
Published
Volume
7 - 2026

Copyright

Copyright © 2026 Bandara, Jayasinghe and Retscher.

License: https://creativecommons.org/licenses/by/4.0/

*Correspondence: Niroshan Sanjaya Bandara

Article metrics

Views
0
Downloads
0
Citations
0
Shares
0