Author: Elhakim Ibrahim
Instructor: Corey Sparks, PhD1
February 14, 2020
This exercise aims to show processes involved in transforming and projecting map from one coordinate reference system (e.g. geographic coordinate system) to another (e.g. projected map coordinate system). This conversion allows for intelligible projection and measurement of distance between locations.
Projections are mathematical transformations that facilitate conversion of locations on 3-D/curved surface of the earth to 2-D/flat surface representation. Basically, all projections are subject to distortions. Hence, it is important to select accurate system of projection that minimizes such distortions and maximizes accuracy.
The 2017 5-year American Community Survey (ACS)2 census tracts-level data for Bexar County, TX accessed from the US Census Bureau website were used for this exercise. Attempts are made to calculate distance between two census tracts based on below transformation and projection approaches:
Fig 1. Detailed map of Bexar County, TX
setwd("C:/A/01/02S20/D093/H/02")
suppressPackageStartupMessages({
library(sf)
library(ggsn)
library(dplyr)
library(ggplot2)
library(tidyverse)
library(tidycensus)
library(RColorBrewer)
})sa_acsh2a <- get_acs(geography = "tract", state = "TX", county = "Bexar", year = 2017,
variables = c("DP05_0001E", "DP03_0119PE"), geometry = T, output = "wide")Getting data from the 2013-2017 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using the ACS Data Profile
# create 5-digit county FIPS code
sa_acsh2a$county <- substr(sa_acsh2a$GEOID, 1, 5)
# rename variables and filter missing cases
sa_acsh2 <- sa_acsh2a %>% mutate(geoid = GEOID, name = NAME, totpop = DP05_0001E,
ppov = DP03_0119PE) %>% na.omit()sf::st_write(sa_acsh2a, dsn = "C:/A/01/02S20/D093/H/01/D", layer = "sa_tract_dp03_R",
driver = "ESRI Shapefile", delete_layer = T, update = T)Deleting layer `sa_tract_dp03_R' using driver `ESRI Shapefile'
Writing layer `sa_tract_dp03_R' to data source `C:/A/01/02S20/D093/H/01/D' using driver `ESRI Shapefile'
features: 366
fields: 7
geometry type: Multi Polygon
# sa_acsh2 <- sa_acsh2[c(geoid, name, totpop, ppov)]
sa_acsh2 <- subset(sa_acsh2, select = c(geoid, name, totpop, ppov))
st_crs(sa_acsh2)Coordinate Reference System:
EPSG: 4269
proj4string: "+proj=longlat +datum=NAD83 +no_defs"
Reproject map into NAD83/South Central Texas CRS
Select two tracts between which distance is to be measured
Get centroid coordinates for the two tracts
Warning in st_centroid.sf(reprjtracts2278): st_centroid assumes attributes
are constant over geometries of x
Measure distance between the tracts
Units: [US_survey_foot]
[,1] [,2]
[1,] 0.00 64043.26
[2,] 64043.26 0.00
Reproject map into NAD83/Texas Centric Albers Equal Area CRS
Select two tracts between which distance is to be measured
Get centroid coordinates for the two tracts
Warning in st_centroid.sf(reprjtracts3083): st_centroid assumes attributes
are constant over geometries of x
Measure distance between the tracts
Units: [m]
[,1] [,2]
[1,] 0.00 19536.81
[2,] 19536.81 0.00
This content adapts steps and examples from instructional materials authored by Dr. Corey Sparks and made available at https://rpubs.com/corey_sparks.
The ACS data are open source resources made available by the US Census Bureau at https://data.census.gov/.
Comments on measured distances
As shown above, there is huge difference in distances resulting from the two projection systems. The NAD83/South Central Texas CRS projection-based distance (12.1 miles, comparably accurate distance) is approximately 3.3 times greater than NAD83/Texas Centric Albers Equal Area CRS projection-based distance (3.7 miles). The difference simply indicates that the NAD83/South Central Texas coordinate system is far more appropriate in projecting Bexar County locational data than the NAD83/Texas Centric Albers Equal Area coordinate system.
The values contained in geometry columns of tables below for the two coordinate systems reflect the extent of select locations misrepresentation by the NAD83/Texas Centric Albers Equal Area coordinate system of projection. This outcome highlights the importance of selecting appropriate coordinate reference system that best represents the locations of interest on earth surface in any projection exercise.