Skip to contents

Preparing interactive map of monitoring points

Usage

plot_map(df, df_station, rch, shp)

Arguments

df

dataframe with formatted data (Station, DATE, Variables and Values columns are needed).

df_station

dataframe with formatted station data (ID, geometry columns are needed).

rch

sf dataframe for reaches (id, geometry columns are needed).

shp

sf dataframe for basin (name, geometry columns are needed).

Value

leaflet object of interactive map with monitoring data opening while pressing on points.

Examples

library(sf)
#> Linking to GEOS 3.9.3, GDAL 3.5.2, PROJ 8.2.1; sf_use_s2() is TRUE
temp_path <- system.file("extdata", "calibration_data.xlsx", package = "svatools")
reach_path <- system.file("extdata", "GIS/reaches.shp", package = "svatools")
basin_path <- system.file("extdata", "GIS/basin.shp", package = "svatools")
cal_data <- load_template(temp_path, 4326)
#> [1] "Loading data from template."
#> [1] "Loading of data is finished."
reach <- st_transform(st_read(reach_path), 4326)
#> Reading layer `reaches' from data source 
#>   `C:\Users\laptop\AppData\Local\R\win-library\4.2\svatools\extdata\GIS\reaches.shp' 
#>   using driver `ESRI Shapefile'
#> Simple feature collection with 125 features and 2 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: 469806.3 ymin: 519299 xmax: 484124.6 ymax: 533957.5
#> Projected CRS: ETRF2000-PL / CS92
basin <-st_transform(st_read(basin_path), 4326)
#> Reading layer `basin' from data source 
#>   `C:\Users\laptop\AppData\Local\R\win-library\4.2\svatools\extdata\GIS\basin.shp' 
#>   using driver `ESRI Shapefile'
#> Simple feature collection with 1 feature and 1 field
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 4898668 ymin: 3304508 xmax: 4915266 ymax: 3319644
#> Projected CRS: ETRS89-extended / LAEA Europe
plot_map(cal_data$data, cal_data$stations, reach, basin)