9  The Environmental Impacts of Globalization

9.1 Introduction

Globalization, while fostering economic growth and cultural exchange, has also had profound environmental impacts. These effects, which manifest differently across various regions, influence ecosystems, biodiversity, and overall planetary health. This chapter explores the historical and contemporary perspectives on the environmental consequences of globalization, emphasizing the spatial dimensions of these changes. By leveraging QGIS and R, we can map and analyze environmental transformations resulting from globalization using geolocated text, images, and structured data.

9.2 The Environmental Impacts of Globalization: Historical and Contemporary Perspectives

Historical Perspective

The early phases of globalization, such as the Industrial Revolution and colonial expansion, initiated widespread environmental changes, including deforestation, soil degradation, and biodiversity loss. These impacts were geographically uneven, with certain regions bearing the brunt of environmental exploitation.

Contemporary Perspective

Modern globalization continues to drive significant environmental changes, such as climate change, pollution, and habitat destruction. The global trade networks, multinational corporations, and technological advancements all contribute to these environmental shifts. The role of geographic information systems (GIS) in understanding these spatial disparities is crucial, as the environmental impacts of globalization vary widely across regions.

Spatial Analysis of Environmental Change

Using QGIS and R, we can analyze and visualize how different regions are affected by globalization’s environmental impacts. This involves integrating various types of geospatial data, enabling a comprehensive understanding of the environmental degradation linked to globalization.

9.3 Hands-On: Animating Time Series Data in QGIS

In this hands-on section, we will learn how to animate time-series data in QGIS, which is a powerful tool for visualizing changes in spatial phenomena over time. Time is often a critical component of datasets, and combining it with spatial data provides valuable insights into trends, patterns, and hotspots that evolve over time. This exercise will demonstrate how to visualize and animate maritime piracy incidents over the past two decades.

Objectives:

  • Create a time-series animation using QGIS’s Temporal Controller.
  • Generate heatmaps to visualize dense point data.
  • Export the animation as a series of images or a GIF for presentation.

Step 1: Data Preparation and Setup

We will work with a dataset of maritime piracy incidents, which includes location information and the date of occurrence. To get started, follow these steps:

  1. Download the Data

    • Download the Anti-shipping Activity Messages (ASAM) dataset from the National Geospatial-Intelligence Agency’s Maritime Safety Information portal. This dataset contains all reported incidents of maritime piracy.
    • Additionally, download the 10m Physical Vectors - Land layer from Natural Earth to provide global land polygons for the basemap.
    • For convenience, you can download the datasets directly from these links:
  2. Load the Data into QGIS

    • Open QGIS and, in the Browser Panel, locate the downloaded data.
    • Expand the ne_10m_land.zip file and drag the ne_10m_land.shp layer onto the canvas to load the land polygons.
    • Similarly, expand the ASAM_shp.zip file, locate the ASAM_events.shp layer, and drag it onto the canvas. This layer contains points representing individual incidents of maritime piracy.
  3. Initial Data Inspection

    • You should now see the global land polygons and piracy incident points on your map. Each point represents a location where a piracy incident occurred.
    • Zoom in and pan around the map to explore the dataset. While the individual points give us a good idea of the distribution of piracy incidents, it’s difficult to identify patterns. A heatmap can provide a clearer picture of the density of piracy hotspots.

Step 2: Creating a Heatmap

To visualize the density of piracy incidents, we’ll use QGIS’s heatmap renderer to display the point data as a heatmap, highlighting areas with a high concentration of incidents.

  1. Open the Layer Styling Panel

    • Select the ASAM_events layer in the Layers panel and click the Open the Layer Styling Panel button (paintbrush icon) located above the Layers panel.
  2. Change the Renderer to Heatmap

    • In the Layer Styling Panel, change the Renderer from Single Symbol to Heatmap. This will automatically create a heatmap based on the point data, making it easier to identify piracy hotspots.
  3. Select a Color Ramp

    • To better visualize the heatmap, click on the Color ramp dropdown and select the Viridis color ramp, which provides a gradient from yellow (low density) to purple (high density).
  4. Adjust the Radius

    • The Radius determines the influence each point has over its surroundings. For this dataset, set the Radius to 5.0. This ensures that each piracy incident influences an area around it, helping to visualize clusters of activity.
  5. Adjust Opacity

    • Scroll down to the Layer Rendering section and set the Opacity to 75%. This allows the heatmap to blend with the underlying land layer, giving a clearer visual of the hotspots overlaid on the map.

Step 3: Enabling the Temporal Controller for Animation

Next, we’ll animate the data to show how piracy hotspots evolved over the past two decades. QGIS’s Temporal Controller will allow us to play the data in yearly intervals and export it as an animation.

  1. Open Layer Properties

    • Right-click the ASAM_events layer in the Layers panel and choose Properties.
  2. Enable Temporal Data

    • In the Layer Properties window, go to the Temporal tab and check the box to enable the temporal functionality.
  3. Configure Temporal Settings

    • In the Configuration dropdown, select Single Field with Date/Time.
    • Choose the dateofocc field (which contains the date of occurrence for each incident) as the field representing the date and time. This will allow the temporal controller to filter incidents based on the time they occurred.
  4. Activate the Temporal Control Panel

    • After enabling temporal functionality, a clock symbol will appear next to the ASAM_events layer in the Layers panel.
    • Click on the Temporal Control Panel button (clock icon) located in the Map Navigation toolbar. This opens the Temporal Controller, which will let you control the animation settings.

Step 4: Animating the Data

Now that the temporal functionality is enabled, we can create an animation of piracy incidents over time.

  1. Set the Time Range

    • In the Temporal Control Panel, click the Set to Full Range button (refresh icon) to automatically set the time range to match the dataset.
  2. Configure the Animation Step

    • Set the Step to 1 Year. This will ensure that the animation moves forward by one year for each frame.
  3. Preview the Animation

    • Click the Play button (triangle icon) to preview the animation. The piracy incidents will appear and disappear as the animation progresses, showing the distribution of incidents over time.
  4. Adjust the Frame Rate

    • If the animation is too fast, click the Temporal Settings button (yellow gear icon) in the top-right corner of the Temporal Controller panel.
    • Adjust the frame rate (frames per second) to slow down the animation, allowing for a more controlled view of the changes over time.

Step 5: Adding a Time Label

To provide context for the animation, we can add a dynamic label that shows the current year as the animation plays.

  1. Open the Title Decoration Settings

    • Go to View > Decorations > Title Label.
  2. Enable the Title Label

    • In the Title Label window, check the Enable box. This will allow you to insert a dynamic label that updates with the current year.
  3. Insert a Dynamic Expression

    • Click the Insert an Expression button and enter the following expression to display the year:

      format_date(@map_start_time, 'yyyy')
    • This expression pulls the current time slice from the Temporal Controller and formats it to display the year.

  4. Customize the Label

    • Set the font size to 25, the background color to White, and adjust the transparency to 50%.
    • Under Placement, choose Bottom Right to position the label in the lower-right corner of the map.
    • Click OK to apply the label.

Step 6: Exporting the Animation

Once the animation is ready, we can export it as a series of images or combine them into an animated GIF.

  1. Export the Animation

    • In the Temporal Controller window, click the Export Animation button (save icon).
  2. Set Output Directory and Extent

    • Choose the output directory where the images will be saved.
    • For Extent, select Calculate from Layer and choose the ne_10m_land layer to ensure the correct spatial extent is used.
  3. Save the Images

    • Once the export is complete, you will have a series of PNG images, one for each year of the animation.

Step 7: Creating an Animated GIF

To convert the exported images into an animated GIF, use an online tool like ezgif.

  1. Upload the Images

    • Visit ezgif.com and click Choose Files to upload the exported PNG files.
    • Select all the PNG files and click Upload and make a GIF.
  2. Create and Download the GIF

    • Once the GIF is created, click the Save button to download the animated GIF.

Conclusion

In this exercise, you learned how to use QGIS’s Temporal Controller to animate time-series data. By visualizing maritime piracy incidents over time, we were able to create a compelling animation showing how piracy hotspots evolved. You also explored creating heatmaps and exporting time-lapse animations as a GIF.

This technique can be applied to a wide range of datasets, from tracking environmental changes to visualizing urban development over time, providing valuable insights through spatial and temporal analysis.

9.4 Using Geolocated Text, Images, and Structured Data to Map Environmental Change

Mapping environmental changes requires integrating diverse data types, including geolocated text, images, and structured data. This section will delve into the techniques for utilizing QGIS and R to process and analyze these data types.

Geolocated Text

Geolocated text from news articles, social media, and scientific reports can be extracted and analyzed to identify areas of environmental concern. Using R packages like tidytext and sf, this information can be mapped and analyzed in QGIS, providing spatial insights into how globalization impacts the environment.

R Code Example:

library(tidytext)
library(sf)
library(dplyr)

# Example of extracting geolocated text and converting it to spatial data
text_data <- read_csv("geolocated_text_data.csv")

# Assuming text_data has columns: latitude, longitude, and environmental_issue
text_sf <- st_as_sf(text_data, coords = c("longitude", "latitude"), crs = 4326)

# Write the spatial data to a shapefile for use in QGIS
st_write(text_sf, "geolocated_text.shp")

Geolocated Images

Satellite imagery and aerial photography are invaluable for monitoring environmental changes like deforestation and urban sprawl. Tools like the raster package in R and QGIS’s robust image analysis capabilities allow for the processing and analysis of these images, contributing to a detailed spatial understanding of environmental impacts.

R Code Example:

library(raster)

# Load and process satellite imagery
sat_image <- raster("satellite_image.tif")

# Example of a simple analysis - calculating NDVI (Normalized Difference Vegetation Index)
ndvi <- (sat_image[[4]] - sat_image[[3]]) / (sat_image[[4]] + sat_image[[3]])

# Write the processed NDVI to a file for further analysis in QGIS
writeRaster(ndvi, "ndvi_output.tif", format = "GTiff")

Structured Data

Structured datasets, such as climate records, pollution measurements, and biodiversity inventories, can be integrated into GIS for temporal and spatial analysis. Using R, data can be tidied, merged with geographic data, and visualized in QGIS to reveal patterns and trends in environmental change.

R Code Example:

library(tidyverse)
library(sf)

# Load structured data (e.g., pollution data with country codes)
pollution_data <- read_csv("pollution_data.csv")

# Assume we have a shapefile of country boundaries
world_map <- st_read("world_shapefile.shp")

# Join structured data with spatial data
pollution_sf <- left_join(world_map, pollution_data, by = "country_code")

# Write the result to a new shapefile for use in QGIS
st_write(pollution_sf, "pollution_map.shp")

9.5 Case Study: Environmental Impact Analysis using QGIS and R

This section integrates QGIS and R into the analysis of environmental impacts due to globalization, with a focus on energy use, water access, and GNI per capita.

Brief Introduction

The world_map2 dataset, derived from ggplot2::map_data("world"), is used for mapping Global Studies data. This dataset includes ISO country codes (Alpha-2, Alpha-3, Numeric) for better integration with various data sources. The following sections demonstrate how to use this dataset with Global Studies data from Gapminder.org.

Case Study: Energy Use

EDA Energy

The dataset “Energy use, per person” is explored and tidied using R, addressing common issues like non-ISO country codes. Visual analysis is performed using vis_dat and glimpse.

Tidy Energy Data

The dataset is transformed into a tidy format using pivot_longer, allowing for easier integration with world_map2 and subsequent spatial analysis.

R Code Example:

library(tidyverse)
library(visdat)
library(here)

# Load the energy dataset
energy_capita <- read_csv(here::here("data", "raw_data", "energy_use_per_person.csv"))

# Explore the dataset
energy_capita %>% vis_dat()
energy_capita %>% glimpse()

# Tidy the dataset
energy_tidy <- energy_capita %>%
  pivot_longer(cols = !country,
               names_to = "year",
               names_transform = list(year = as.integer),
               values_to = "energy")

Mapping Energy Use

The tidied dataset is merged with world_map2 using left_join, followed by the application of complete to ensure that missing data is gracefully handled. The resulting maps are visualized in QGIS.

R Code Example:

# Load world_map2 dataset
load(here::here("data", "tidy_data", "maps", "world_map2_project.rda"))

# Map the energy data
energy_map <- energy_tidy %>%
  filter(year == 2004) %>%
  complete(country = world_map2$country, fill = list(energy = NA)) %>%
  left_join(world_map2, by = "country") %>%
  ggplot(aes(x = long, y = lat, group = group, fill = energy)) +
  geom_polygon() +
  scale_fill_viridis_c() +
  theme_void()

# Save the plot
ggsave("energy_map_2004.png", plot = energy_map, width = 10, height = 7)

# Export data for QGIS
write_sf(st_as_sf(energy_map), "energy_map_2004.shp")

Case Study: Water Access

EDA Water Access

The dataset “At least basic water source, overall access” is explored similarly, focusing on data tidying and integration with world_map2.

R Code Example:

# Load the water access dataset
water_access <- read_csv(here::here("data", "raw_data", "at_least_basic_water_source_overall_access_percent.csv"))

# Explore the dataset
water_access %>% vis_dat()
water_access %>% glimpse()

# Tidy the dataset
water_tidy <- water_access %>%
  pivot_longer(cols = !country,
               names_to = "year",
               names_transform = list(year = as.integer),
               values_to = "water")

Mapping Water Access

Water access data is mapped using the same procedure as the energy use case study, demonstrating the versatility of the workflow.

R Code Example:

# Map the water data
water_map <- water_tidy %>%
  filter(year == 2010) %>%
  complete(country = world_map2$country, fill = list(water = NA)) %>%
  left_join(world_map2, by = "country") %>%
  ggplot(aes(x = long, y = lat, group = group, fill = water)) +
  geom_polygon() +
  scale_fill_viridis_c() +
  theme_void()

# Save the plot
ggsave("water_map_2010.png", plot = water_map, width = 10, height = 7)

# Export data for QGIS
write_sf(st_as_sf(water_map), "water_map_2010.shp")

Case Study: GNI Per Capita

EDA GNI Per Capita

GNI per capita data presents additional challenges, such as non-numeric formats and special characters. These issues are addressed using string manipulation and data cleaning techniques in R.

R Code Example:

# Load the GNI dataset
gni_percapita <- read_csv(here::here("data", "raw_data", "gnipercapita_ppp_current_international.csv"))

# Explore and clean the dataset
gni_tidy <- gni_percapita %>%
  pivot_longer(cols = !country,
               names_to = "year",
               names_transform = list(year = as.integer),
               values_to = "gni_ppp_cap") %>%
  mutate(gni_ppp_cap = readr::parse_number(gni_ppp_cap)) %>%
  mutate(gni_ppp_cap = case_when(
    gni_ppp_cap < 

200 ~ gni_ppp_cap * 1000,
    TRUE ~ gni_ppp_cap)) %>%
  mutate(country = case_when(
    country == "Curaçao" ~ "Curacao",
    country == "Sint Maarten (Dutch part)" ~ "Sint Maarten",
    TRUE ~ country))

Mapping GNI Per Capita

The cleaned GNI per capita data is mapped to illustrate global income disparities, showcasing how economic globalization impacts different regions.

R Code Example:

# Map the GNI data
gni_map <- gni_tidy %>%
  filter(year == 2017) %>%
  complete(country = world_map2$country, fill = list(gni_ppp_cap = NA)) %>%
  left_join(world_map2, by = "country") %>%
  ggplot(aes(x = long, y = lat, group = group, fill = gni_ppp_cap)) +
  geom_polygon() +
  scale_fill_viridis_c() +
  theme_void()

# Save the plot
ggsave("gni_map_2017.png", plot = gni_map, width = 10, height = 7)

# Export data for QGIS
write_sf(st_as_sf(gni_map), "gni_map_2017.shp")

Summary

The three above case studies show how to use Global studies data and world_map2 with complete() to produce better choropleth maps. As opposed to the default ggplot2::map_data("world"), the updated world_map2 both fails gracefully when we have missing countries or data and contains the following standard ISO country codes: Alpha-2 code, Alpha-3 code, and Numeric code. As such, we can match by country name to the majority of Gapminder.org datasets, and we can match by ISO codes to any Global Studies dataset which uses them. The bottom line: better graphs and improved interoperability while keeping it (relatively) simple in the Tidyverse.

By utilizing these tools and techniques, researchers and policymakers can gain a deeper understanding of the environmental consequences of globalization, paving the way for more sustainable practices.