This tutorial provides a concise, step-by-step guide to accessing and visualising VEClim risk maps in R using the leaflet package. It is intended as a quick introduction to working with VEClim’s tile-based map services.
The example below demonstrates how to generate an interactive map similar to the one shown:
library(leaflet)
leaflet() |>
addProviderTiles(providers$CartoDB.Positron) |>
addTiles(
urlTemplate = "https://veclim.com/api?v=colegg&x={x}&y={y}&z={z}",
attribution = "VEClim"
) |>
setView(lng = 33.4, lat = 35.2, zoom = 3)
In addition to visualising the tiles directly, you can also query the VEClim API to retrieve metadata about the available map layers, including their identifiers and associated colour scales.
The following example shows how to request a list of available tile layers and inspect the colour key for a selected layer:
library(httr2)
library(jsonlite)
txt <- request("https://veclim.com/api?v=tiles") |> req_perform() |> resp_body_string()
js <- fromJSON(txt, simplifyVector = FALSE)
js['colegg']