Maps in R

library(sf)          # dealing with spatial tables
library(terra)       # handeling raster data
library(tidyterra)   # handeling terra
library(tidyverse)
library(ggspatial)   # some useful ggplot2 additions
library(ggrepel)     # handeling text on plots
library(patchwork)   # for assembling multiple ggplots
library(maps)        # some basic country maps
library(mapdata)     # higher resolution maps
library(marmap)      # access global topgraphy data
library(mregions)    # access to various marine regions, including EEZ

Reference map

Maps as background for ggplot-plot can come from myriad of sources. Here we take an example of shoreline that reside in the {map} and {mapdata}-packages as well as from GADM. The latter provides generally a higher resolutions of countries shoreline than the two former data-sources.

{mapdata}

To get the data into required ggplot2 form (a dataframe) we use the map_data-function:

my_region <- "Saint Lucia"
lca <- map_data("worldHires", region = my_region)
lca |> glimpse()
Rows: 188
Columns: 6
$ long      <dbl> -60.93836, -60.94335, -60.94695, -60.95137, -60.95475, -60.9…
$ lat       <dbl> 13.71776, 13.71581, 13.71277, 13.71002, 13.70945, 13.71500, …
$ group     <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
$ order     <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1…
$ region    <chr> "Saint Lucia", "Saint Lucia", "Saint Lucia", "Saint Lucia", …
$ subregion <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …

Here we have just a simple dataframe with 188 coordinates (long and lat) and some other variables. We can try map these coordinates to different layers:

m <- 
  ggplot(lca, aes(long, lat, group = group)) +
  labs(x = NULL, y = NULL)
m1 <- m + geom_point(size = 0.5) + labs(title = "geom_point")
m2 <- m + geom_line() + labs(title = "geom_line")
m3 <- m + geom_path() + labs(title = "geom_path")
m4 <- m + geom_polygon() + labs(title = "geom_polygon")
m1 + m2 + m3 + m4  # patchwork package handles this nicely

There is nothing magic about background “map” data. In principle it is just ordered x- and y-points, of which geom_path and geom_polygon handle nicely. The group argument above is useful e.g. if a country has more than one entity (like islands). An example is Guadeloupe:

glp <- 
  map_data("worldHires", region = "Guadeloupe") |> 
  ggplot(aes(long, lat, group = group)) +
  geom_path()
glp

There one additional thing that is needed when plotting maps and that is the aspect ration, i.e. the ratio of the dimensions between x (longitude) and y (latitude). For ordinary dataframes, {ggplot2} provides two functions for that: coord_quickmap and coord_map, nomally the former is sufficient:

glp + coord_quickmap()

Those that are familiar with both St. Lucia and Guadeloupe know that the outlines of the countries as plotted above are very course. And in the case of Guadeloupe some of the smaller islands are actually missing. In general the map resolution needed depends on the purpose of the plot and scale of the plot. The resolution of the shoreline above would suffice if we were to plot a map on a regional scale. However the details may not be sufficient if one were to create a map on a country scale.

GADM

A little better resolution than provide by the {map}- and {mapdata}-package is that provided by GADM - a list of the available countries can be obtained here. To a map of a country one needs to specify the 3-letter country code. We can read a map of Guadelupe directly into R:

# Generate a handy function, in case we want any country map
read_gadm <- function(country_code = "LCA") { 
  pth <- paste0("https://geodata.ucdavis.edu/gadm/gadm4.1/gpkg/gadm41_",
                country_code,
                ".gpkg")
  suppressWarnings(read_sf(pth))
}

glp <- read_gadm(country_code = "GLP")
class(glp)
[1] "sf"         "tbl_df"     "tbl"        "data.frame"

The class of the object (“sf”) returned may be novice for the beginner. Let’s take a peek:

glp
Simple feature collection with 1 feature and 2 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -61.81014 ymin: 15.83153 xmax: -61.00014 ymax: 16.51486
Geodetic CRS:  WGS 84
# A tibble: 1 × 3
  GID_0 COUNTRY                                                             geom
  <chr> <chr>                                                 <MULTIPOLYGON [°]>
1 GLP   Guadeloupe (((-61.60986 15.83875, -61.60986 15.83847, -61.60958 15.8384…

We actually have a dataframe with a variable named “geom” that is of class MULTIPOLYGON. In the header we get then some additional spatial information. What we have is simply dataframe with some very special spatial constructs within it. If you want to delve into the spatial realm of the R we suggest the following two books:

Take note that the in the above dataframe we do not have any variables that correspond to longitute and latitude, since they are actually stored within the geom(etry)-variable. To plot such spatial objects we simply call the geom_sf-function:

ggplot() +
  geom_sf(data = glp)

Note that here we do not need to call coord_quickmap because the projection is taken care of when we call geom_sf.

We can easily add layers to a map, like landings locations and names in St. Lucia:

# get a gadm-map of St. Lucia
lca <- read_gadm(country_code = "LCA")
# landings sites
sites <- 
  tribble(~site          ,        ~lon,     ~lat,   ~type   ,
          "Anse-La-Raye"   , -61.04358, 13.94095, "Primary"   ,
          "Bannanes"       , -61.00056, 14.01117, "Secondary" ,
          "Canaries"       , -61.06785, 13.90629, "Secondary" ,
          "Castries"       , -60.99230, 14.01618, "Primary"   ,
          "Choiseul"       , -61.05047, 13.77464, "Primary"   ,
          "Dennery"        , -60.88690, 13.91171, "Primary"   ,
          "Gros-Islet"     , -60.95271, 14.07893, "Primary"   ,
          "Laborie"        , -60.99555, 13.75008, "Primary"   ,
          "Marigot"        , -61.02503, 13.96628, "Secondary" ,
          "Micoud"         , -60.89523, 13.81980, "Primary"   ,
          "Praslin"        , -60.89823, 13.87391, "Secondary" ,
          "Riviere-doree"  , -61.03742, 13.75919, "Secondary" ,
          "Savannes-Bay"   , -60.93207, 13.76298, "Primary"   ,
          "Soufriere"      , -61.06069, 13.85646, "Primary"   ,
          "Vieux-Fort"     , -60.95540, 13.72517, "Primary")

ggplot() +
  geom_sf(data = lca) +
  geom_point(data = sites,
             aes(lon, lat, colour = type)) +
  scale_colour_brewer(palette = "Set1") +
  geom_text_repel(data = sites,
            aes(lon, lat, label = site, colour = type)) +
  theme(legend.position = "none") +
  labs(x = NULL, y = NULL)

Above we use geom_text_repel (from the {ggrepel}-package) for the landing site names, a function that tries to automatically nudge the name location such that “overplotting” is minimised.

EZZ

We can obtain country’s EEZ using the mr_shp-function from the {mregion}-package.

eez <- mr_shp(key = "MarineRegions:eez")

One can then filter the needed EEZ by using e.g. any of the following variables:

eez |> 
  st_drop_geometry() |> 
  select(geoname, territory1, iso_ter1) |> 
  arrange(geoname) |> 
  knitr::kable()
geoname territory1 iso_ter1
Albanian Exclusive Economic Zone Albania ALB
Algerian Exclusive Economic Zone Algeria DZA
American Samoa Exclusive Economic Zone American Samoa ASM
Amsterdam Island & St. Paul Island Exclusive Economic Zone Amsterdam and Saint Paul Islands ATF
Angolan Exclusive Economic Zone Angola AGO
Anguilla Exclusive Economic Zone Anguilla AIA
Antarctic 200NM zone beyond the coastline Antarctica ATA
Antigua and Barbuda Exclusive Economic Zone Antigua and Barbuda ATG
Argentinean Exclusive Economic Zone Argentina ARG
Aruban Exclusive Economic Zone Aruba ABW
Ascension Exclusive Economic Zone Ascension SHN
Australian Exclusive Economic Zone Australia AUS
Australian Exclusive Economic Zone (Macquarie Island) Macquarie Island NA
Azerbaijanis Exclusive Economic Zone Azerbaijan AZE
Bahamas Exclusive Economic Zone Bahamas BHS
Bahraini Exclusive Economic Zone Bahrain BHR
Bangladeshi Exclusive Economic Zone Bangladesh BGD
Barbados Exclusive Economic Zone Barbados BRB
Bassas da India Exclusive Economic Zone Bassas da India ATF
Belgian Exclusive Economic Zone Belgium BEL
Belizean Exclusive Economic Zone Belize BLZ
Beninese Exclusive Economic Zone Benin BEN
Bermudian Exclusive Economic Zone Bermuda BMU
Bonaire Exclusive Economic Zone Bonaire BES
Bosnian and Herzegovinian Exclusive Economic Zone Bosnia and Herzegovina BIH
Brazilian Exclusive Economic Zone Brazil BRA
Brazilian Exclusive Economic Zone (Trindade) Trindade NA
British Virgin Islands Exclusive Economic Zone British Virgin Islands VGB
Bruneian Exclusive Economic Zone Brunei BRN
Bulgarian Exclusive Economic Zone Bulgaria BGR
Cambodian Exclusive Economic Zone Cambodia KHM
Cameroonian Exclusive Economic Zone Cameroon CMR
Canadian Exclusive Economic Zone Canada CAN
Cape Verdean Exclusive Economic Zone Cape Verde CPV
Cayman Islands Exclusive Economic Zone Cayman Islands CYM
Chagos Archipelago Exclusive Economic Zone Chagos Archipelago NA
Chilean Exclusive Economic Zone Chile CHL
Chilean Exclusive Economic Zone (Easter Island) Easter Island NA
Chilean Exclusive Economic Zone (San Felix and San Ambrosio islands) Islas San Flix and San Ambrosio CHL
Chinese Exclusive Economic Zone China CHN
Christmas Island Exclusive Economic Zone Christmas Island CXR
Clipperton Exclusive Economic Zone Clipperton Island NA
Cocos Islands Exclusive Economic Zone Cocos Islands CCK
Colombian Exclusive Economic Zone Colombia COL
Colombian Exclusive Economic Zone (Bajo Nuevo) Bajo Nuevo Bank NA
Colombian Exclusive Economic Zone (Quitasueo) Quitasueo Bank NA
Colombian Exclusive Economic Zone (Serrana) Serrana Bank NA
Colombian Exclusive Economic Zone (Serranilla) Serranilla Bank NA
Comoran Exclusive Economic Zone Comores COM
Congolese Exclusive Economic Zone Republic of the Congo COG
Cook Islands Exclusive Economic Zone Cook Islands COK
Costa Rican Exclusive Economic Zone Costa Rica CRI
Croatian Exclusive Economic Zone Croatia HRV
Crozet Islands Exclusive Economic Zone Crozet Islands ATF
Cuban Exclusive Economic Zone Cuba CUB
Curaaoan Exclusive Economic Zone Curaao CUW
Cypriote Exclusive Economic Zone Cyprus CYP
Danish Exclusive Economic Zone Denmark DNK
Democratic Republic of the Congo Exclusive Economic Zone Democratic Republic of the Congo COD
Djiboutian Exclusive Economic Zone Djibouti DJI
Dominican Exclusive Economic Zone Dominica DMA
Dominican Republic Exclusive Economic Zone Dominican Republic DOM
Dutch Exclusive Economic Zone Netherlands NLD
East Timorian Exclusive Economic Zone East Timor TLS
Ecuadorian Exclusive Economic Zone Ecuador ECU
Ecuadorian Exclusive Economic Zone (Galapagos) Galapagos NA
Egyptian Exclusive Economic Zone Egypt EGY
El Salvador Exclusive Economic Zone El Salvador SLV
Equatorial Guinean Exclusive Economic Zone Equatorial Guinea GNQ
Eritrean Exclusive Economic Zone Eritrea ERI
Estonian Exclusive Economic Zone Estonia EST
Faeroe Exclusive Economic Zone Faeroe FRO
Fijian Exclusive Economic Zone Fiji FJI
Finnish Exclusive Economic Zone Finland FIN
French Exclusive Economic Zone France FRA
French Guiana Exclusive Economic Zone French Guiana GUF
French Polynesian Exclusive Economic Zone French Polynesia PYF
Gabonese Exclusive Economic Zone Gabon GAB
Gambian Exclusive Economic Zone Gambia GMB
Georgian Exclusive Economic Zone Georgia GEO
German Exclusive Economic Zone Germany DEU
Ghanaian Exclusive Economic Zone Ghana GHA
Greek Exclusive Economic Zone Greece GRC
Greenlandic Exclusive Economic Zone Greenland GRL
Grenadian Exclusive Economic Zone Grenada GRD
Guadeloupean Exclusive Economic Zone Guadeloupe GLP
Guam Exclusive Economic Zone Guam GUM
Guatemalan Exclusive Economic Zone Guatemala GTM
Guernsey Exclusive Economic Zone Guernsey GGY
Guinea Bissau Exclusive Economic Zone Guinea-Bissau GNB
Guinean Exclusive Economic Zone Guinea GIN
Guyanese Exclusive Economic Zone Guyana GUY
Haitian Exclusive Economic Zone Haiti HTI
Heard and McDonald Islands Exclusive Economic Zone Heard and McDonald Islands HMD
Honduran Exclusive Economic Zone Honduras HND
Howland and Baker Islands Exclusive Economic Zone Howland and Baker islands UMI
Icelandic Exclusive Economic Zone Iceland ISL
Ile Europa Exclusive Economic Zone Europa Island ATF
Indian Exclusive Economic Zone India IND
Indian Exclusive Economic Zone (Andaman and Nicobar Islands) Andaman and Nicobar NA
Indonesian Exclusive Economic Zone Indonesia IDN
Iranian Exclusive Economic Zone Iran IRN
Iraqi Exclusive Economic Zone Iraq IRQ
Irish Exclusive Economic Zone Ireland IRL
Israeli Exclusive Economic Zone Israel ISR
Italian Exclusive Economic Zone Italy ITA
Ivory Coast Exclusive Economic Zone Ivory Coast CIV
Jamaican Exclusive Economic Zone Jamaica JAM
Jan Mayen Exclusive Economic Zone Jan Mayen SJM
Japanese Exclusive Economic Zone Japan JPN
Jarvis Island Exclusive Economic Zone Jarvis Island UMI
Jersey Exclusive Economic Zone Jersey JEY
Johnston Atoll Exclusive Economic Zone Johnston Atoll UMI
Joint regime area Argentina / Uruguay Uruguay URY
Joint regime area Colombia / Dominican Republic Dominican Republic DOM
Joint regime area Colombia / Jamaica Jamaica JAM
Joint regime area Costa Rica / Ecuador (Galapagos) Costa Rica CRI
Joint regime area Croatia / Slovenia Croatia HRV
Joint regime area Ecuador / Colombia Ecuador ECU
Joint regime area Guyana / Barbados Barbados BRB
Joint regime area Honduras / Cayman Islands Honduras HND
Joint regime area Iceland / Denmark (Faeroe Islands) Faeroe FRO
Joint regime area Iceland / Norway (Jan Mayen) Iceland ISL
Joint regime area Italy / France France FRA
Joint regime area Japan / Korea South Korea KOR
Joint regime area Nigeria / Sao Tome and Principe Sao Tome and Principe STP
Joint regime area Peru / Ecuador Peru PER
Joint regime area Senegal / Guinea Bissau Senegal SEN
Joint regime area Spain / France France FRA
Joint regime area Sweden / Norway Norway NOR
Joint regime area United Kingdom / Denmark (Faeroe Islands) United Kingdom GBR
Joint regime area United States / Russia United States USA
Jordanian Exclusive Economic Zone Jordan JOR
Juan de Nova Exclusive Economic Zone Juan de Nova Island ATF
Kazakh Exclusive Economic Zone Kazakhstan KAZ
Kenyan Exclusive Economic Zone Kenya KEN
Kerguelen Exclusive Economic Zone Kergulen ATF
Kiribati Exclusive Economic Zone (Gilbert Islands) Gilbert Islands KIR
Kiribati Exclusive Economic Zone (Line Islands) Line Group KIR
Kiribati Exclusive Economic Zone (Phoenix Islands) Phoenix Group KIR
Kuwaiti Exclusive Economic Zone Kuwait KWT
Latvian Exclusive Economic Zone Latvia LVA
Lebanese Exclusive Economic Zone Lebanon LBN
Liberian Exclusive Economic Zone Liberia LBR
Libyan Exclusive Economic Zone Libya LBY
Lithuanian Exclusive Economic Zone Lithuania LTU
Madagascan Exclusive Economic Zone Madagascar MDG
Malaysian Exclusive Economic Zone Malaysia MYS
Maldives Exclusive Economic Zone Maldives MDV
Maltese Exclusive Economic Zone Malta MLT
Marshall Islands Exclusive Economic Zone Marshall Islands MHL
Martinican Exclusive Economic Zone Martinique MTQ
Mauritanian Exclusive Economic Zone Mauritania MRT
Mauritian Exclusive Economic Zone Republic of Mauritius MUS
Mexican Exclusive Economic Zone Mexico MEX
Micronesian Exclusive Economic Zone Micronesia FSM
Montenegrin Exclusive economic Zone Montenegro MNE
Montserrat Exclusive Economic Zone Montserrat MSR
Mongasque Exclusive Economic Zone Monaco MCO
Moroccan Exclusive Economic Zone Morocco MAR
Mozambican Exclusive Economic Zone Mozambique MOZ
Myanmar Exclusive Economic Zone Myanmar MMR
Namibian Exclusive Economic Zone Namibia NAM
Nauruan Exclusive Economic Zone Nauru NRU
New Caledonian Exclusive Economic Zone New Caledonia NCL
New Zealand Exclusive Economic Zone New Zealand NZL
Nicaraguan Exclusive Economic Zone Nicaragua NIC
Nigerian Exclusive Economic Zone Nigeria NGA
Niue Exclusive Economic Zone Niue NIU
Norfolk Island Exclusive Economic Zone Norfolk Island NFK
North Korean Exclusive Economic Zone North Korea PRK
Northern Mariana Exclusive Economic Zone Northern Mariana Islands MNP
Norwegian Exclusive Economic Zone Norway NOR
Oecussi Ambeno Exclusive Economic Zone Oecusse NA
Omani Exclusive Economic Zone Oman OMN
Overlapping claim Alhucemas Islands: Spain / Morocco Alhucemas Islands NA
Overlapping claim Ceuta: Spain / Morocco Ceuta NA
Overlapping claim Chafarinas Islands: Spain / Morocco Chafarinas Islands NA
Overlapping claim Doumeira Islands: Djibouti / Eritrea Doumeira Islands NA
Overlapping claim Falkland / Malvinas Islands: UK / Argentina Falkland / Malvinas Islands FLK
Overlapping claim Gibraltarian Exclusive Economic Zone Gibraltar GIB
Overlapping claim Glorioso Islands: France / Madagascar Glorioso Islands NA
Overlapping claim Ile Tromelin: Reunion / Madagascar / Mauritus Ile Tromelin NA
Overlapping claim Kuril Islands: Japan / Russia Kuril Islands NA
Overlapping claim Liancourt Rocks: Japan / South Korea Liancourt Rocks NA
Overlapping claim Matthew and Hunter Islands: New Caledonia / Vanuatu Matthew and Hunter Islands NA
Overlapping claim Mayotte: France / Comoros Mayotte MYT
Overlapping claim Melilla: Spain / Morocco Melilla NA
Overlapping claim Navassa Island: USA / Haiti / Jamaica Navassa Island NA
Overlapping claim Perejil Island: Spain / Morocco Perejil Island NA
Overlapping claim Pen de Vlez de la Gomera: Spain / Morocco Pen de Vlez de la Gomera NA
Overlapping claim Qatar / Saudi Arabia / United Arab Emirates Qatar QAT
Overlapping claim Senkaku Islands: Japan / China / Taiwan Senkaku Islands NA
Overlapping claim South China Sea China CHN
Overlapping claim South Georgia and South Sandwich Islands: UK / Argentina South Georgia and the South Sandwich Islands SGS
Overlapping claim Ukrainian Exclusive Economic Zone Ukraine UKR
Overlapping claim Western Saharan Exclusive Economic Zone Western Sahara ESH
Overlapping claim: Canada / USA Canada CAN
Overlapping claim: Iran / United Arab Emirates United Arab Emirates ARE
Overlapping claim: Kenya / Somalia Kenya KEN
Overlapping claim: Puerto Rico / Dominican Republic Puerto Rico PRI
Overlapping claim: Sudan / Egypt Sudan SDN
Overlapping claim: Trinidad and Tobago / Venezuela / Guyana Guyana GUY
Overlapping claim: Venezuela / Aruba / Dominican Republic Venezuela VEN
Overlapping claim: Venezuela / Colombia / Dominican Republic Colombia COL
Pakistani Exclusive Economic Zone Pakistan PAK
Palau Exclusive Economic Zone Palau PLW
Palestinian Exclusive Economic Zone Palestine PSE
Palmyra Atoll Exclusive Economic Zone Palmyra Atoll UMI
Panamanian Exclusive Economic Zone Panama PAN
Papua New Guinean Exclusive Economic Zone Papua New Guinea PNG
Peruvian Exclusive Economic Zone Peru PER
Philippines Exclusive Economic Zone Philippines PHL
Pitcairn Islands Exclusive Economic Zone Pitcairn PCN
Polish Exclusive Economic Zone Poland POL
Portuguese Exclusive Economic Zone Portugal PRT
Portuguese Exclusive Economic Zone (Azores) Azores NA
Portuguese Exclusive Economic Zone (Madeira) Madeira NA
Protected Zone established under the Torres Strait Treaty Papua New Guinea PNG
Puerto Rican Exclusive Economic Zone Puerto Rico PRI
Qatari Exclusive Economic Zone Qatar QAT
Romanian Exclusive economic Zone Romania ROU
Russian Exclusive economic Zone Russia RUS
Runion Exclusive Economic Zone Runion REU
Saba Exclusive Economic Zone Saba BES
Saint Kitts and Nevis Exclusive Economic Zone Saint Kitts and Nevis KNA
Saint Lucia Exclusive Economic Zone Saint Lucia LCA
Saint Vincent and the Grenadines Exclusive Economic Zone Saint Vincent and the Grenadines VCT
Saint-Barthlemy Exclusive Economic Zone Saint-Barthlemy BLM
Saint-Martin Exclusive Economic Zone Collectivity of Saint Martin MAF
Saint-Pierre and Miquelon Exclusive Economic Zone Saint-Pierre and Miquelon SPM
Samoan Exclusive Economic Zone Samoa WSM
Sao Tome and Principe Exclusive Economic Zone Sao Tome and Principe STP
Saudi Arabian Exclusive Economic Zone Saudi Arabia SAU
Senegalese Exclusive Economic Zone Senegal SEN
Seychellois Exclusive Economic Zone Seychelles SYC
Sierra Leonian Exclusive Economic Zone Sierra Leone SLE
Singaporean Exclusive Economic Zone Singapore SGP
Sint-Eustatius Exclusive Economic Zone Sint-Eustatius BES
Sint-Maarten Exclusive Economic Zone Sint-Maarten SXM
Slovenian Exclusive Economic Zone Slovenia SVN
Solomon Islands Exclusive Economic Zone Solomon Islands SLB
Somali Exclusive Economic Zone Federal Republic of Somalia SOM
South African Exclusive Economic Zone South Africa ZAF
South African Exclusive Economic Zone (Prince Edward Islands) Prince Edward Islands NA
South Korean Exclusive Economic Zone South Korea KOR
Spanish Exclusive Economic Zone Spain ESP
Spanish Exclusive Economic Zone (Canary Islands) Canary Islands NA
Sri Lankan Exclusive Economic Zone Sri Lanka LKA
St. Helena Exclusive Economic Zone Saint Helena SHN
Sudanese Exclusive Economic Zone Sudan SDN
Surinamese Exclusive Economic Zone Suriname SUR
Svalbard Exclusive Economic Zone Svalbard SJM
Swedish Exclusive Economic Zone Sweden SWE
Syrian Exclusive Economic Zone Syria SYR
Taiwanese Exclusive Economic Zone Taiwan TWN
Tanzanian Exclusive Economic Zone Tanzania TZA
Thailand Exclusive Economic Zone Thailand THA
Togolese Exclusive Economic Zone Togo TGO
Tokelau Exclusive Economic Zone Tokelau TKL
Tongan Exclusive Economic Zone Tonga TON
Trinidad and Tobago Exclusive Economic Zone Trinidad and Tobago TTO
Tristan Da Cunha Exclusive Economic Zone Tristan da Cunha SHN
Tunisian Exclusive Economic Zone Tunisia TUN
Turkish Exclusive Economic Zone Turkey TUR
Turkmen Exclusive Economic Zone Turkmenistan TKM
Turks and Caicos Exclusive Economic Zone Turks and Caicos Islands TCA
Tuvaluan Exclusive Economic Zone Tuvalu TUV
United Arab Emirates Exclusive Economic Zone United Arab Emirates ARE
United Kingdom Exclusive Economic Zone United Kingdom GBR
United States Exclusive Economic Zone United States USA
United States Exclusive Economic Zone (Alaska) Alaska NA
United States Exclusive Economic Zone (Hawaii) Hawaii NA
Uruguayan Exclusive Economic Zone Uruguay URY
Vanuatu Exclusive Economic Zone Vanuatu VUT
Venezuelan Exclusive Economic Zone Venezuela VEN
Vietnamese Exclusive Economic Zone Vietnam VNM
Virgin Islander Exclusive Economic Zone United States Virgin Islands VIR
Wake Island Exclusive Economic Zone Wake Island UMI
Wallis and Futuna Exclusive Economic Zone Wallis and Futuna WLF
Yemeni Exclusive Economic Zone Yemen YEM

An example for generating a map of St. Lucia and its EEZ is as follows:

ggplot() +
  geom_sf(data = eez |> filter(iso_ter1 == "LCA")) +
  geom_sf(data = lca)

Bathymetry

One can obtain bathymetry data from https://download.gebco.net. In the following example we read a geotiff file obtained (by mouseclicks etc.) from the gebco site:

download.file("https://heima.hafro.is/~einarhj/crfmr/aux/gebco_2022_n15.7874_s11.5906_w-64.8193_e-58.2495.tif",
              destfile = "carb.tif")
z <- rast("carb.tif")

names(z) <- "depth"
# limit the area to that of St. Lucia
bb <- st_bbox(c(xmin = -61.25, xmax = -60.6,
                ymin = 13.4, ymax = 14.3))
z <- crop(z, bb)
# values above sealevel set to NA
i <- values(z) > 0
values(z)[i] <- NA
# all values deeper than 1500 m set to 1500 m
i <- values(z) < -1500
values(z)[i] <- -1500

# hillshade with grey colors
slope <- terrain(z, "slope", unit = "radians")
aspect <- terrain(z, "aspect", unit = "radians")
hill <- shade(slope, aspect, 10, 340)

p <- 
  ggplot() +
  theme_void() +
  geom_spatraster(data = hill, show.legend = FALSE) +
  # Note the scale, grey colours
  scale_fill_gradientn(colours = grey(0:100 / 100), na.value = NA) +
  ggnewscale::new_scale_fill() +
  geom_spatraster(data = z, alpha = 0.55, show.legend = FALSE) +
  geom_spatraster_contour(data = z, colour = "red", linewidth = 0.4,
                          breaks = c(-25, -50, -100, -200, -500, -750, -1000)) +
  scale_fill_viridis_c() +
  #geom_sf(data = eez1, colour = "white") +
  theme(legend.position = "none") +
  annotation_scale(pad_x = unit(1, "cm"),
                   pad_y = unit(1, "cm"))
p