evolMap

Modesto Escobar, David Barrios, Carlos Prieto (University of Salamanca)

2025-07-01

Evolving Maps with evolMap

Introduction

The evolMap package provides an easy and flexible way to create interactive, time-evolving maps from spatial data in R. It is particularly useful for visualizing historical changes, events over time, or evolving geospatial datasets, using Leaflet as the underlying engine. Key features include:

This vignette demonstrates how to use evolMap to:

Description

The evolMap package represents and manages information from a database on an interactive geographic map. It also allows you to view the evolution of added elements over time or through periods.

Components:

Example 1: Visualizing Pompeii Parcels from GeoJSON

library(evolMap)
library(sf)

Read geojson

# Source: https://github.com/scriptorivm/pompeii
domi <- st_read('https://raw.githubusercontent.com/scriptorivm/pompeii/master/geojson/domi.geojson')

domi[["info"]] <- paste0("<iframe src=\"",sub("http:","https:",domi[["N3"]]),"\"></iframe>")
domi[is.na(domi[["N3"]]),"info"] <- "Missing info"

Map creation and add information of geojson

You can specify initial coordinates and zoom level in create_map function

map <- create_map(center=c(40.750556,14.489722), zoom=16)
map <- add_entities(map,domi,info="info")
plot(map, directory = "pompeii")
## The graph has been generated in the "C:\Users\modes\AppData\Local\Temp\RtmpmaZawI\Rbuild62784ddf762d\evolMap\vignettes\pompeii" path.

Change Base Map Provider

# https://leaflet-extras.github.io/leaflet-providers/preview/
map <- create_map(center=c(40.750556,14.489722), zoom=16, provider="OpenStreetMap.HOT")
map <- add_entities(map,domi,info="info")
plot(map, directory = "pompeii_provider")
## The graph has been generated in the "C:\Users\modes\AppData\Local\Temp\RtmpmaZawI\Rbuild62784ddf762d\evolMap\vignettes\pompeii_provider" path.

Example 2: Ukraine War — Evolving Event Map

# Source: https://ukraine.bellingcat.com/
data <- read.csv(system.file("extdata", "ukr-civharm-2023-02-27.csv",
        package="evolMap"))
data[["date"]] <- as.Date(data[["date"]],"%m/%d/%Y")

data[["type"]] <- NA
for(i in seq_len(nrow(data))){
  if(data[i,"associations"]!=""){
    data[i,"type"] <- unlist(strsplit(unlist(strsplit(data[i,"associations"],","))[1],"="))[2]
  }
}

map <- create_map(center=c(49.3402,31.9146),zoom=6.75)
map <- add_markers(map, data, color = "type",
  latitude = "latitude", longitude = "longitude",
  start = "date")
plot(map, dir="ukraine")
## The graph has been generated in the "C:\Users\modes\AppData\Local\Temp\RtmpmaZawI\Rbuild62784ddf762d\evolMap\vignettes\ukraine" path.

Example: Change Map Style with mode = 2

map <- create_map(center=c(49.3402,31.9146),zoom=6.75, mode=2)
map <- add_markers(map, data, color = "type",
  latitude = "latitude", longitude = "longitude",
  start = "date")
plot(map, dir="ukraineNew")
## The graph has been generated in the "C:\Users\modes\AppData\Local\Temp\RtmpmaZawI\Rbuild62784ddf762d\evolMap\vignettes\ukraineNew" path.

Summary

The evolMap package enables: