Libraries

# SPDS
library(tidyverse)
library(sf)
library(units)

# Data
library(USAboundaries)
library(rnaturalearth)

# Visualization
library(gghighlight)
library(ggrepel)
library(knitr)

Question 1: Accessing Datasets for US State Boundaries, North American Country Boundaries, and US Cities

For this project we want to calculate distances between features, therefore we need a projection that preserves distance at the scale of CONUS. For this, we will use the North America Equidistant Conic:

eqdc = '+proj=eqdc +lat_0=40 +lon_0=-96 +lat_1=20 +lat_2=60 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs'

Based on its parameters, this projection has a name of eqdc, a latitude of origin at 40, central meridian at 96, latitude of first standard parallel at 20 and second standard parallel at 60, datum name of NAD83, and units in meters.

conus = USAboundaries::us_states() %>% 
  filter(!state_name %in% c("Puerto Rico", "Alaska", "Hawaii")) %>% 
  st_transform(eqdc)
na_boundaries <- rnaturalearth::countries110
na_boundaries <- na_boundaries %>% 
  st_as_sf() %>% 
  filter(admin %in% c("United States of America", "Mexico", "Canada")) %>% 
  st_transform(eqdc)
cities = readr::read_csv("../data/uscities.csv") %>%
  st_as_sf(coords = c("lng", "lat"), crs = 4326) %>% 
  st_transform(eqdc) %>% 
  filter(!state_name %in% c("Alaska", "Hawaii", "Puerto Rico"))

Question 2: Calculating the Distance of Each US City to (1) National Border (2) Nearest State Border (3) Mexican Border and (4) Canadian Border

5 Cities Furthest from the US Border
City State Distance (km)
Dresden Kansas 1012.317
Herndon Kansas 1007.750
Hill City Kansas 1005.147
Atwood Kansas 1004.734
Jennings Kansas 1003.646
5 Cities Furthest from a State Border
City State Distance (km)
Lampasas Texas 308.9216
Bertram Texas 302.8190
Kempner Texas 302.5912
Harker Heights Texas 298.8125
Florence Texas 298.6804
5 Cities Furthest from the Mexican Border
City State Distance (km)
Caribou Maine 3250.334
Presque Isle Maine 3234.570
Calais Maine 3134.348
Eastport Maine 3125.624
Old Town Maine 3048.366
5 Cities Furthest from the Canadian Border
City State Distance (km)
Guadalupe Guerra Texas 2206.455
Sandoval Texas 2205.641
Fronton Texas 2204.784
Fronton Ranchettes Texas 2202.118
Evergreen Texas 2202.020

Question 3: Visualization





Question 4: Cities Within 100 Miles of US Border

Background:

Recently, Federal Agencies have claimed basic constitutional rights protected by the Fourth Amendment (protecting Americans from random and arbitrary stops and searches) do not apply fully at our borders (see Portland). For example, federal authorities do not need a warrant or suspicion of wrongdoing to justify conducting what courts have called a “routine search,” such as searching luggage or a vehicle. Specifically, federal regulations give U.S. Customs and Border Protection (CBP) authority to operate within 100 miles of any U.S. “external boundary”. Further information can be found at this ACLU article.

Cities Within 100 Mile Zone of Border
Number of Cities Population Within 100 Miles of Border Percentage of Total Population
12,283 259,935,815 65.43979

These findings match the ACLU estimate in the link above as the article state that nearly two-thirds of the population live within 100 miles of the boarder which is about 200 million people.