Introduction

drawing

Political Map of South Africa

In the contemporary global landscape, mineral resources are critical to technological progress and economic development. Africa, rich in essential minerals like rare earth elements and precious metals such as cobalt and tantalum, is essential in supporting various critical industries. However, these resources are extracted and managed with security challenges, including conflicts, extortion, and bribery by armed groups. These issues compromise the operational stability of mining endeavors, pose significant risks to human safety, and disrupt global supply chains. This project seeks to identify the spatial distribution of crucial mineral resources across Africa alongside the patterns of security incidents within these regions. By integrating primary geospatial datasets from the United States Geological Survey (USGS) and the Armed Conflict Location & Event Data Project (ACLED), the project aims to illuminate the interactions between mineral resource management and security dynamics. The objectives of this study include mapping the spatial distributions of critical minerals and analyzing the temporal and spatial patterns of security incidents related to mining operations. This approach is intended to aid in formulating effective policies to enhance security and resource management, ultimately contributing to the stability and efficiency of mining operations in Africa. By mapping the distribution of minerals and security incidents, identifying clusters and trends, and exploring the correlation between mineral presence and security risks, the analysis aims to offer insights for risk assessment, strategic planning, and policy development. The findings are expected to offer valuable insights and actionable recommendations for policymakers, industry stakeholders, and security planners, fostering a more secure and prosperous future for mineral resource management on the continent. This project aligns with historical and contemporary research on the nexus between mineral wealth and conflict and positions itself at the forefront of applying Spatial Data Science to address these enduring challenges.

Load Library Packages

The first step for this analysis is to load the library packages that will be used throughout the process. The packages are:

tidyverse = Includes the packages that are use in everyday data analyses, such as ggplot2, dplyr, and readr to name a few. Additional details can be found at This Site

RColorBrewer = Provides color schemes for maps (and other graphics) designed by Cynthia Brewer. Additionalinformation on this package can be found at This Site

sf =Support for simple features, a standardized way to encode spatial vector data. Additional information can be located at This Site

leaflet = Is used to create interactive web maps with the JavaScript ‘Leaflet’ Library. Additional details can be found at This Site

leaflet.extras = This package serves as an add-on to the ‘leaflet’ package by providing extra functionality via ‘leaflet’ plugins. Additional details can be found at This Site

gganimate = The grammar of graphics as implemented in the ‘ggplot2’ package has been successful in providing a powerful API for creating static visualisation. Additional information can be located at This Site

here = Enables easy file referencing in project-oriented workflows. Additional details can be found at This Site

library(tidyverse)
library(RColorBrewer)
library(sf)
library(leaflet)
library(leaflet.extras)
library(gganimate)
library(here)

Data Used For Analysis

Data Primary data sources include the United States Geological Survey (USGS) for mineral resource data and the Armed Conflict Location & Event Data Project (ACLED) for information on security incidents. These datasets will be analyzed using Spatial Data Science techniques in R to uncover insights into the spatial dynamics of mineral resource distribution and security challenges. This project will leverage the following datasets:

2. Armed Conflict Location & Event Data Project (ACLED)

ACLED data is instrumental in analyzing the patterns of security incidents near mining facilities. This dataset provides insights into the frequency, location, and nature of security incidents, which are crucial for understanding the risks associated with mineral resource extraction in conflict-prone areas. This study will take detailed records of conflict events and other security incidents over the past 20 years to provide the temporal context of event trends.

The attributes that will be used for this study are:

  • Event Dates and Locations: Provides temporal and spatial details of security incidents.

  • Actors Involved: Information on the groups involved in the incidents, which can be critical for understanding conflict dynamics.

  • Fatality Numbers: Offers insight into the severity of incidents.

  • Types of Incidents: Classifications of events, e.g., battles, violence against civilians, and protests, which help distinguish the nature of security risks.

The spatial extent for this project is focused on South Africa with the temporal range of 2004-2023.

The ACLED data used for this project can be located at The Armed Conflict Location & Event Data Project

To begin the analysis, lets load the necessary data.

# Path of the shapefile

shapefile_path <- here("data", "MiningFacilitiesSouthAfrica.shp.zip")

# Load shapefile

mining_facilities <- st_read(shapefile_path)
## Reading layer `MiningFacilitiesSouthAfrica' from data source 
##   `E:\PSU\GEOG588 Analytical Approaches in Spatial Data Science\R-Studio Labs\Final Project\Data\MiningFacilitiesSouthAfrica.shp.zip' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 452 features and 29 fields
## Geometry type: POINT
## Dimension:     XYZ
## Bounding box:  xmin: 16.777 ymin: -35.30673 xmax: 32.13667 ymax: 25.70719
## z_range:       zmin: 0 zmax: 0
## Geodetic CRS:  WGS 84
# Load the ACLED CSV File for South Africa.

SouthAfricaACLED <- read_csv(here("data","ACLED 2004 01 01 - 2024 01 01 - South Africa.csv")) 

Exploring The Geographic Dispersion of Critical Mineral Mining Operations Within South Africa

Now that the data has been loaded, let’s examine where the critical minerals mining facilities are located at for Chromium, Cobalt, Manganese, Platinum, and Titanium to see the geographic distribution.

South Africa Mineral Facilities Geographic Distribution

# Filter for specific minerals
mining_facilities_filtered <- mining_facilities[mining_facilities$DsgAttr02 %in% c("Chromium", "Cobalt", "Manganese", "Platinum", "Titanium"),]

# Convert to simple features
mining_facilities_sf <- st_as_sf(mining_facilities_filtered, coords = c("Longitude", "Latitude"), crs = 4326)

# Set Color Palette based on the filtered minerals
color_palette <- colorFactor(palette = brewer.pal(5, "Dark2"), domain = mining_facilities_filtered$DsgAttr02)

# Create a map and add filtered mining facilities as clustered circle markers
map <- leaflet(mining_facilities_sf) %>%
  addProviderTiles(providers$Esri.WorldGrayCanvas) %>%
  setView(lat = -29, lng = 23, zoom = 6)%>%
  addCircleMarkers(
    color = ~color_palette(DsgAttr02), # Adjust to color by mineral type
    fillOpacity = 1,
    radius = 5,
    popup = ~paste("<strong>Name:</strong>", FeatureNam,
                   "<br><strong>Type:</strong>", FeatureTyp,
                   "<br><strong>Production Volume:</strong>", DsgAttr07, " ", DsgAttr08,
                   "<br><strong>Mineral Type:</strong>", DsgAttr02),
    label = ~paste(FeatureNam, "-", FeatureTyp),
    clusterOptions = markerClusterOptions(spiderfyOnMaxZoom = FALSE)
  )

# Add a legend to the map

map <- map %>%
  addLegend("bottomleft", 
            pal = color_palette, 
            values = ~DsgAttr02, 
            title = "Type of Mineral", 
            opacity = 1)

# Uses Leaflet’s built-in layers control you can choose one of base layers included into the project

map <- map %>%
  addProviderTiles(providers$Esri.WorldGrayCanvas, group = "Grayscale") %>%   # This web map provides a detailed vector basemap for the world featuring a neutral                                                                                  background style with minimal colors, labels, and features.
  
  addProviderTiles(providers$Esri.WorldTopoMap, group = "Topographic") %>%    # This web map provides a detailed vector basemap for the world featuring a classic                                                                                  Esri topographic map style including a relief map.
  
  addProviderTiles(providers$Esri.WorldImagery, group = "Imagery") %>%        # This web map features satellite imagery for the world and high-resolution aerial                                                                                   imagery for many areas. 
  
  addLayersControl (baseGroups = c("Grayscale", "Topographic", "Imagery"))

# Add a mini map

map <- map %>%
  addTiles(providers$Esri.WorldTopoMap) %>%        # Ensure the main map has a base layer
  addMiniMap(tiles = providers$Esri.WorldTopoMap,  # Base layer for the mini map
             width = 150, height = 150,            # Adjust size as needed
             toggleDisplay = TRUE)                 # Allows users to toggle the mini map

# Adding a scale bar to the map, both imperial and metric measurements

map <- map %>%
  addScaleBar(position = "bottomright", 
              options = scaleBarOptions(imperial = TRUE, metric = TRUE))

# Print the map to display the final result

map

As we can observe, the majority of the mining facilities are located in the North/North-Eastern region of South Africa. In total, there are 29 Chromium mines, 8 Cobalt mines, 9 Manganese mines, 30 Platinum mines, and 13 Titanium mines for a total of 88 mining facilities. As we can see, South Africa is a mineral rich country that has the potential of conflict activities occurring. Now let’s look at the ACLED data to determine what conflict events have occurred in South Africa for the past 20 years.

Exploring Twenty Years of Armed Conflict Location & Events Within South Africa

South Africa has faced various challenges over the years, including political instability, violence, and conflict. This analysis aims to explore the dynamics of these events using data from the Armed Conflict Location & Event Data Project (ACLED). By examining the data, we seek to uncover trends in conflict and violence, the distribution of events across different regions, and the actors most involved in these incidents.

The data used spans from 2004 to the end of 2023, including nearly 26,000 recorded events in South Africa. These events range from battles and violence against civilians to protests and riots. For the purpose of this analysis, we focus on key variables such as event type, location, fatalities, and involved actors.

Before we look a conflict data trends, the data format within the ACLED dataset will need an adjustment for ease of processing.

# Convert event_date to Date type format for analysis use.

SouthAfricaACLED$event_date <- as.Date(SouthAfricaACLED$event_date, format = "%d-%b-%y")

Now that the data has been read, let’s examine the information that will be used for analysis.

glimpse(SouthAfricaACLED)
## Rows: 25,959
## Columns: 32
## $ event_id_cnty      <chr> "SAF20349", "SAF20349", "SAF20350", "SAF20350", "SA…
## $ event_date         <date> 2023-12-31, 2023-12-31, 2023-12-31, 2023-12-31, 20…
## $ year               <dbl> 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 202…
## $ time_precision     <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, …
## $ disorder_type      <chr> "Political violence", "Political violence", "Politi…
## $ event_type         <chr> "Violence against civilians", "Violence against civ…
## $ sub_event_type     <chr> "Attack", "Attack", "Attack", "Attack", "Peaceful p…
## $ actor1             <chr> "Unidentified Armed Group (South Africa)", "Civilia…
## $ assoc_actor_1      <chr> NA, "Ndebele Ethnic Group (South Africa)", NA, NA, …
## $ inter1             <dbl> 3, 7, 3, 7, 6, 3, 7, 6, 3, 7, 3, 7, 1, 7, 6, 1, 7, …
## $ interaction        <dbl> 37, 37, 37, 37, 60, 37, 37, 60, 37, 37, 37, 37, 17,…
## $ civilian_targeting <chr> "Civilian targeting", "Civilian targeting", "Civili…
## $ iso                <dbl> 710, 710, 710, 710, 710, 710, 710, 710, 710, 710, 7…
## $ region             <chr> "Southern Africa", "Southern Africa", "Southern Afr…
## $ country            <chr> "South Africa", "South Africa", "South Africa", "So…
## $ admin1             <chr> "Gauteng", "Gauteng", "Western Cape", "Western Cape…
## $ admin2             <chr> "City of Tshwane", "City of Tshwane", "City of Cape…
## $ admin3             <chr> "City of Tshwane", "City of Tshwane", "City of Cape…
## $ location           <chr> "Pretoria", "Pretoria", "Cape Town - Philippi", "Ca…
## $ latitude           <dbl> -25.7449, -25.7449, -34.0167, -34.0167, -33.9186, -…
## $ longitude          <dbl> 28.1878, 28.1878, 18.5500, 18.5500, 18.3897, 28.304…
## $ geo_precision      <dbl> 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ source             <chr> "Sowetan (South Africa)", "Sowetan (South Africa)",…
## $ source_scale       <chr> "National", "National", "National", "National", "Na…
## $ notes              <chr> "On 31 December 2023, three armed suspects shot and…
## $ fatalities         <dbl> 2, 2, 1, 1, 0, 1, 1, 0, 1, 1, 2, 2, 1, 1, 0, 1, 1, …
## $ tags               <chr> NA, NA, NA, NA, "crowd size=over 300", "women targe…
## $ timestamp          <dbl> 1704766941, 1704766941, 1704766941, 1704766941, 170…
## $ population_1km     <dbl> 21723, 21723, 378, 378, 6757, 6236, 6236, 9769, 133…
## $ population_2km     <dbl> 39637, 39637, 1704, 1704, 22735, 11395, 11395, 3240…
## $ population_5km     <dbl> 43172, 43172, 17985, 17985, 69977, 18002, 18002, 83…
## $ population_best    <dbl> 43172, 43172, 17985, 17985, 6757, 18002, 18002, 976…

From here, we can see the various attributes such as event date, event type, and casualty numbers to name a few. This specific dataset for this analysis focuses on South Africa, covering events from January 1, 2004, to January 1, 2024. The dataset contains just about 26,000 events recorded during this period, providing a rich source for understanding the dynamics of conflict and violence in South Africa.

The dataset includes several key variables that are utilized throughout the analysis to draw insights into the conflict situation in South Africa:

  • event_date: The date when an event occurred. This variable is crucial for any time-series analysis, allowing us to observe how events have evolved over time.

  • year: Extracted from event_date, it’s used to aggregate data annually, making it easier to identify long-term trends.

  • event_type: This categorizes the nature of each event (e.g., battles, violence against civilians, protests, and riots), enabling a comparative analysis of different types of conflict and violence.

  • sub_event_type: Offers a more detailed classification of each event, providing deeper insights into the specific nature of the conflict or protest.

  • actor1: The main actor involved in the event. This variable helps identify the most active groups or forces in the conflict.

  • location, latitude, longitude: These geographical details allow for mapping the distribution of events, highlighting areas with higher concentrations of violence or protests.

  • fatalities: The number of fatalities resulting from each event. This is a critical variable for assessing the human impact of the conflict.

Analysis of ACLED data

Events Over Time By Type

The “Events in South Africa Over Time by Type” analysis aims to dissect the evolution of conflict and protest events in South Africa, categorizing these events by their types to identify trends and shifts in the nature of occurrences over a specified period. This analysis uses data from the Armed Conflict Location & Event Data Project (ACLED), focusing on categorizing and visualizing the frequency of various event types (such as battles, violence against civilians, protests, and riots) across the years. The main goal of this analysis is to illustrate how different types of conflict and protest events have changed in frequency over time in South Africa. By doing so, it seeks to provide insights into the dynamics of conflict, highlighting periods of increased activity for certain types of events and potentially correlating these changes with broader socio-political developments.

The aggregated data is visualized using a line plot or stacked area chart, with the x-axis representing time (years) and the y-axis representing the count of events. Different colors or lines represent different event types, making it easier to compare trends across categories.By observing the changes in the lines or areas corresponding to each event type, analysts can identify trends, such as increasing battles or decreasing protests, over the observed period. This can highlight shifts in the nature of conflict and social unrest in South Africa.

# Time Series Plot: Events over Time by Type
ggplot(SouthAfricaACLED, aes(x = event_date, fill = event_type)) +
  geom_histogram(binwidth = 30, position = "stack") +
  scale_fill_brewer(palette = "Set3") +
  labs(x = "Date", y = "Count of Events", title = "Events in South Africa Over Time by Type", fill = "Event Type") +
  theme_minimal()

Regional Distribution of Events

The distribution of events across South Africa’s regions highlights areas with higher frequencies of conflict and violence. The “Regional Distribution of Events” analysis within the ACLED dataset for South Africa focuses on understanding how conflict events are geographically spread across the country. This analysis aims to identify regions that are more prone to certain types of conflict and violence, providing a spatial dimension to the understanding of conflict dynamics in South Africa. The primary goal of this analysis is to map the frequency of different types of conflict-related events (e.g., battles, violence against civilians, protests) across South Africa’s administrative regions. By doing so, it seeks to uncover geographic patterns in the distribution of conflict, highlighting areas of high activity and potentially uncovering regional dynamics that influence the occurrence of these events.

Utilizing ggplot2, faceted plots (also known as small multiples) are created to visualize the data. Each facet represents a different region, and within each facet, events are categorized by type. This approach allows for a direct comparison across regions, highlighting differences in the types and frequencies of conflict events.

events_by_region <- SouthAfricaACLED %>%
  group_by(admin1, event_type) %>%
  summarise(count = n(), .groups = 'drop')

ggplot(events_by_region, aes(x = event_type, y = count, fill = event_type)) +
  geom_bar(stat = "identity", position = "dodge") +
  facet_wrap(~admin1) +
  scale_fill_brewer(palette = "Paired") +
  labs(x = "Event Type", y = "Count of Events", title = "Frequency of Events by Region") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

As it looks, Gauteng Province, located in the North-Central region of South Africa, has a high propensity for violent events.

drawing

Provential Map of South Africa

South Africa ACLED Heat Map

Now that we have examined the various statistics within the ACLED data, let’s visually examine where the majority of events have occurred within South Africa.

# Create a leaflet map for ACLED Heatmap

map <- leaflet(SouthAfricaACLED) %>%
  addProviderTiles(providers$Esri.WorldGrayCanvas, options = providerTileOptions(noWrap = TRUE)) %>%  
  setView(lat = -29, lng = 23, zoom = 6) %>%
  addHeatmap(lng = ~longitude, lat = ~latitude, intensity = ~1, radius = 10, blur = 18,
    max = 0.8, gradient = c("0" = "blue", "0.25" = "green", "0.55" = "yellow", "1" = "red")) %>%
  addLegend(position = "bottomleft", 
            title = "Heatmap Intensity",
            colors = c("#0000FF", "#00FF00", "#FFFF00", "#FF0000"), 
            labels = c("Low", "Medium-Low", "Medium-High", "High"),
            opacity = 1)

map <- map %>%
  
  addProviderTiles(providers$Esri.WorldGrayCanvas, group = "Grayscale") %>%   # This web map provides a detailed vector basemap for the world featuring a neutral                                                                                  background style with minimal colors, labels, and features.
  
  addProviderTiles(providers$Esri.WorldTopoMap, group = "Topographic") %>%    # This web map provides a detailed vector basemap for the world featuring a classic                                                                                  Esri topographic map style including a relief map.
  
  addProviderTiles(providers$Esri.WorldImagery, group = "Imagery") %>%        # This web map features satellite imagery for the world and high-resolution aerial                                                                                   imagery for many areas. 
  
  addLayersControl (baseGroups = c("Grayscale", "Topographic", "Imagery"))

# Add a mini map

map <- map %>%
  addTiles(providers$Esri.WorldTopoMap) %>%        # Ensure the main map has a base layer
  addMiniMap(tiles = providers$Esri.WorldTopoMap,  # Base layer for the mini map
             width = 150, height = 150,            # Adjust size as needed
             toggleDisplay = TRUE)                 # Allows users to toggle the mini map

# Adding a scale bar to the map, both imperial and metric measurements

map <- map %>%
  addScaleBar(position = "bottomright", 
              options = scaleBarOptions(imperial = TRUE, metric = TRUE))

# Print the map
map

As we observe, the concentrations of the events have occurred in the South West, North, and along the Eastern coast of South Africa. From the previous look at the conflict data, the heat map further confirmed the concentration of violent events within the Gauteng Province. From here we can compare where the events have taken place in relation to the mining facilities.

Putting it All Together

Based on the concentration of mining facilities in the Northern Region, and the density of historical violence events in the Gauteng Province, we can conclude that there is a concern of local violance distrupting mining operations within the region. Let’s take a look at both datasets on the same map to verify.

# Set Color Palette based on the filtered minerals
color_palette <- colorFactor(palette = brewer.pal(5, "Dark2"), domain = mining_facilities_filtered$DsgAttr02)

# Create a map
map <- leaflet() %>%
  addProviderTiles(providers$Esri.WorldGrayCanvas) %>%
  setView(lat = -29, lng = 23, zoom = 6)

# Add mineral data as clustered circle markers
map <- map %>%
  addCircleMarkers(data = mining_facilities_sf, color = ~color_palette(DsgAttr02), fillOpacity = 1,
                   radius = 5, clusterOptions = markerClusterOptions(),
                   popup = ~paste("<strong>Name:</strong>", FeatureNam,
                                  "<br><strong>Type:</strong>", FeatureTyp,
                                  "<br><strong>Production Volume:</strong>", DsgAttr07, " ", DsgAttr08,
                                  "<br><strong>Mineral Type:</strong>", DsgAttr02))

# Add a Mineral Type legend to the map

# map <- map %>%   addLegend("bottomleft", pal = color_palette, values = ~DsgAttr02, title = "Type of Mineral", opacity = 1)

# Add ACLED data as a heatmap layer
map <- map %>%
  addHeatmap(data = SouthAfricaACLED, lng = ~longitude, lat = ~latitude, intensity = ~1, radius = 10, blur = 18,
             max = 0.8, gradient = c("0" = "blue", "0.25" = "green", "0.55" = "yellow", "1" = "red")) %>%
  addLegend("bottomleft", colors = c("#0000FF", "#00FF00", "#FFFF00", "#FF0000"), labels = c("Low", "Medium-Low", "Medium-High", "High"),
            title = "Heatmap Intensity")

# Add additional layers and controls
map <- map %>%
  addProviderTiles(providers$Esri.WorldTopoMap, group = "Topographic") %>%
  addProviderTiles(providers$Esri.WorldImagery, group = "Imagery") %>%
  addLayersControl(baseGroups = c("Grayscale", "Topographic", "Imagery")) %>%
  addMiniMap(tiles = providers$Esri.WorldTopoMap, width = 150, height = 150, toggleDisplay = TRUE) %>%
  addScaleBar(position = "bottomright", options = scaleBarOptions(imperial = TRUE, metric = TRUE))

# Display the final map
map

After combining the two layers, we can see that in fact, the clustering of mining facilities and concentrations of violent acts were in the North West Province along the boarder of Gauteng Province.

Conclusion

The analysis undertaken to investigate the correlation between mineral resource distribution and security incidents in South Africa has provided valuable insights into the spatial dynamics of these phenomena. By integrating geospatial datasets from the United States Geological Survey (USGS) and the Armed Conflict Location & Event Data Project (ACLED), the study aimed to uncover patterns and interactions between mineral resource management and security dynamics.

The examination of mineral resource distribution has revealed a concentration of mining facilities in the North/North-Eastern region of South Africa. This area is significant for chromium, cobalt, manganese, platinum, and titanium mining operations. The concentration of these operations underscores the importance of understanding security dynamics in these regions, as it directly impacts the stability and efficiency of mining operations, a crucial aspect for stakeholders involved in mineral resource management.

The analysis of security incidents, as recorded in the ACLED dataset, has highlighted patterns of conflict and violence across South Africa over the past two decades. The study has provided insights into the temporal and spatial dynamics of security challenges, categorizing events such as battles, violence against civilians, protests, and riots. The Gauteng Province has emerged as a hotspot for violent events, indicating a potential risk to mining operations in the surrounding areas, a concern that necessitates immediate attention from stakeholders.

Furthermore, visualizing event trends over time and by type offered a comprehensive understanding of conflict dynamics, illustrating periods of heightened activity and shifts like events. By mapping the regional distribution of events, the study identified areas with higher conflict frequencies, enabling stakeholders to target resources and interventions effectively.

The juxtaposition of mining facility locations with the spatial distribution of security incidents revealed areas of overlap, particularly in the North West Province bordering Gauteng Province. This alignment suggests a potential correlation between mineral resource extraction activities and security challenges, highlighting the need for proactive measures to mitigate risks and safeguard mining operations.

In conclusion, the analysis underscores the importance of considering security dynamics in tandem with mineral resource management. By leveraging geospatial data and analytical techniques, stakeholders can gain actionable insights for risk assessment, strategic planning, and policy development. Addressing security concerns is crucial for fostering a secure and prosperous environment conducive to sustainable mineral resource management in South Africa.