OTC_Advisor is an interactive R Shiny application designed to evaluate and visualize Outdoor Thermal Comfort (OTC) in urban outdoor spaces. The tool allows users to upload meteorological data, apply machine learning models for thermal comfort classification, visualize results on dynamic maps, and export outputs in multiple formats. This modular approach enables urban planners, researchers, and technicians to quickly assess perceived thermal sensation at different locations and times, supporting decisions on urban design, climate mitigation, and environmental intervention.
- Multiple file format support: Upload data in Excel (.xlsx), CSV (.csv), ZIP (containing shapefiles), or Geopackage (.gpkg) formats
- Required environmental variables:
Air_temperature(°C)Relative_humidity(%)Wind_speed(m/s)- One radiant temperature source:
Radiant_temperature,Globe_temperature, ORSolar_radiation
- Optional coordinates:
LongitudeandLatitudefor spatial visualization
The application includes three machine learning algorithms, each with two classification modes:
- Naive-Bayes (NBD): A simple probabilistic model based on Bayes' theorem, effective with small datasets
- XGBoost (XGB): Advanced gradient boosting ensemble learning algorithm, highly accurate for structured data
- Multilayer Perceptron (MLP): Artificial neural network that models complex non-linear relationships
- Binary: Predicts thermal comfort probability (0-100%)
- Output:
OTC_Probability(percentage of comfort likelihood)
- Output:
- Multiclass: Predicts thermal comfort category
- Output:
OTC_Predictionwith categories:- Very cold
- Cold
- Neither cool nor warm
- Warm
- Very hot
- Output:
All models were trained on the RUROS Mediterranean dataset.
Users can customize predictions based on individual characteristics:
- Gender: Male, Female
- Age: < 12, 13-17, 18-24, 25-34, 35-44, 45-54, 55-64, > 65
- Clothing (clo):
- Light short-sleeved T-shirt and shorts (0.3 clo)
- Long-sleeved T-shirt or polo with light trousers (0.5 clo)
- Long-sleeved shirt + lightweight long trousers (0.7 clo)
- Office wear: shirt, long trousers, light jacket (0.9 clo)
- Full business suit (1.0 clo)
- Warmer clothing (1.2 clo)
- Metabolic rate (met):
- Seated relaxed (58 W/m²)
- Standing (80 W/m²)
- Walking (150 W/m²)
- Bicycling (232 W/m²)
- Running (464 W/m²)
If not specified, the application uses values from the uploaded data file.
The app can calculate the Universal Thermal Climate Index (UTCI) independently:
- Computes UTCI values from environmental data
- Provides UTCI classification categories
- Can be used without OTC model predictions
Dynamic leaflet maps display classified data with extensive customization:
- Variable selection: Display any numeric or categorical variable
- Environmental: Air_temperature, Globe_temperature, Relative_humidity, Wind_speed, Radiant_temperature
- Results: UTCI, Classification.UTCI, OTC_Probability, OTC_Prediction
- Base map styles:
- OpenStreetMap (OSM)
- Satellite imagery
- Esri base maps
- Layer opacity: Adjust transparency (0-100%)
- Raster resolution: Control grid density (20-200 cells)
- Interpolation radius: Set estimation buffer around data points (100-1000 meters)
- Uses K-Nearest Neighbors (KNN with k=1) for spatial interpolation
Interactive data table showing:
- All input variables
- Calculated UTCI values and classifications
- OTC predictions (probability or category)
- Numeric values rounded to 3 decimal places
- Horizontal scrolling for many columns
Real-time status panel displaying:
- Number of observations
- Variable statistics
- Data completeness indicators
Download results in multiple formats:
- CSV: Comma-separated values
- Excel: .xlsx with formatting
- Plain text: .txt file
- Geopackage: .gpkg for GIS software
Download interactive map as standalone HTML file.
Just open the .Rproj file and launch the following:
renv::install("remotes")
remotes::install_github("RodGal-2020/ArchiData")
renv::restore()
Launch the Shiny app:
shiny::runApp()Or use the "Run App" button in RStudio.
- Upload data: Click "📤 Upload Excel, CSV, ZIP File with Shapefiles or Geopackage"
- Choose classification mode: Select Binary or Multiclass
- Select model: Choose between NBD, XGB, or MLP
- (Optional) Enable custom personal settings and configure your profile
- Classify: Click "⚙️ Classify OTC" button
- Visualize: Explore results on the interactive map
- Adjust map: Modify visualization settings (opacity, resolution, variable, etc.)
- Export: Download results in your preferred format
Alternatively, use "Only Calculate UTCI" to compute thermal index without OTC classification.
- Framework: R Shiny with shinydashboard
- Spatial processing: terra, gstat, FNN packages
- Machine learning: tidymodels ecosystem
- Visualization: leaflet for interactive maps
- Data handling: readxl, openxlsx, DT packages
OTC_Advisor/
├── server.R # Server logic
├── ui.R # User interface
├── models/ # Trained ML models (.RData)
│ ├── XGB_binary.RData
│ ├── XGB_multiclass.RData
│ ├── NB_binary.RData
│ ├── NB_multiclass.RData
│ ├── MLP_binary.RData
│ ├── MLP_multiclass.RData
│ └── otc_classification.R
├── utils/ # Helper functions
│ ├── calculate_utci.R
│ ├── calculate_mrt.R
│ ├── change_var.R
│ ├── raster_map2.R
│ └── status_summary.R
├── read_files/ # Data input/output functions
├── templates/ # Example data files
└── renv/ # Package management
- Multiple data format support (.xlsx, .csv, .zip, .gpkg)
- Three ML classification models (Naive-Bayes, XGBoost, MLP)
- Binary classification (comfort probability)
- Multiclass classification (5 thermal categories)
- All trained on RUROS Mediterranean dataset
- Interactive leaflet map visualization
- Map customization options
- Background transparency control
- Raster resolution adjustment
- Interpolation radius settings
- Multiple export formats (CSV, Excel, TXT, Geopackage)
- Spatial interpolation (KNN with k=1)
- UTCI calculation and classification
- Custom personal settings (gender, age, clothing, metabolic rate)
- Data summary dashboard
- Enhanced interpolation methods (Kriging, IDW, optimized KNN)
- Weather API integration (Weather Underground, OpenWeatherMap)
- Temporal filtering (date/time ranges, hourly/daily aggregation)
- UI/UX improvements (status bars, collapsible panels, custom themes)
- Additional thermal comfort indices (PET, PMV, SET*)
- Batch processing for large datasets
- User feedback system
If you use this tool in your research, please cite the UTHECA project and the RUROS dataset used for model training.
[Add license information]
For questions, feedback, or contributions, please contact the development team or open an issue on GitHub.