Skip to contents

This function generates an interactive map with monitoring points, allowing users to click on points to view data.

Usage

plot_map(df, df_station, rch, shp)

Arguments

df

Dataframe with formatted data (requires "Station", "DATE", "Variables", and "Values" columns). Data can be loaded with load_template function using 'xlsx' template file.

df_station

Dataframe with formatted station data (requires "ID" and "geometry" columns).

rch

sf dataframe for reaches (requires "id" and "geometry" columns).

shp

sf dataframe for basin (requires "name" and "geometry" columns).

Value

Leaflet object of an interactive map with monitoring data displayed when points are clicked.

Examples

if (FALSE) {
library(sf)
# Example using calibration data
temp_path <- system.file("extdata", "calibration_data.xlsx", package = "SWATprepR")
reach_path <- system.file("extdata", "GIS/reaches.shp", package = "SWATprepR")
basin_path <- system.file("extdata", "GIS/basin.shp", package = "SWATprepR")
cal_data <- load_template(temp_path, 4326)
reach <- st_transform(st_read(reach_path), 4326)
basin <- st_transform(st_read(basin_path), 4326)
plot_map(cal_data$data, cal_data$stations, reach, basin)
}