Results Table

dist <- hux(Projection = c("NAD83 (original ACS pull)","NAD83 South Texas Central","NAD83 TX Centric Albers Equal Area"), Meters = prettyNum(c(19523,19520,19537),big.mark = ","),Feet = prettyNum(c(64052,64043,64097),big.mark = ","))
dist %>% 
      set_all_padding(4) %>% 
      set_outer_padding(0) %>% 
      set_number_format(NA) %>% 
      set_bold(1, everywhere) %>% 
      set_bottom_border(1, everywhere) %>% 
      set_width(0.7) %>% 
      set_caption("Distances Measured by Projection System")
Distances Measured by Projection System
ProjectionMetersFeet
NAD83 (original ACS pull)19,52364,052
NAD83 South Texas Central19,52064,043
NAD83 TX Centric Albers Equal Area19,53764,097

Questions

  1. Repeat this process, but use the NAD83 layer instead. What is the distance between the two points? Is this distance interpretable? For the original ACS pull, this data was already projected into a coordinate system. So in this case, yes the measure is interpretable, but might not be the most accurate or comparable to other measures people might consider standard.

  2. Reproject the layer into a new coordinate system, use NAD83 / Texas Centric Albers Equal Area. Re measure the distance. How does it compare to the one you got using the Texas South Central projection? The Centric Albers projection produces a longer distance between the two points than the TX South Central Projection, by 17 meters/54 feet. If two people were attempting to reference the same distance/location on maps with these two projection systems, there would be some issues.

  3. In general, why is it important to have an accurate system of projection? How could your results be sensitive to this? Without an accurate projection system, the lines drawn on the map might not correspond to their physical relation in space and geography. Distances could be skewed shorter or longer, with the same happening to areas of polygons and positions of points. Even if measures are a few feet off, this could lead to damaging consequences for engineers, property surveyors, and anyone else reliant on accurate measurements.

Calculations Below

#This lab complements the [exercise using Qgis for today ](https://docs.google.com/document/d/e/2PACX-1vQVSD4MKW4rTSQaNlM1cOULh-0-rSpoAaU3N_Xe7elujIj-ELgWTIGVDygF8qKl3QVBtpxPSi7YuDOS/pub)

#Here, we use tidycensus to read some tract data, learn its projection information, transform it to a new coordinate system and measure some distance between features. 

library(tidycensus)
library(sf)
## Linking to GEOS 3.8.1, GDAL 3.1.4, PROJ 6.3.1
library(dplyr)
### Read in Bexar county tracts
sa_acs<-get_acs(geography = "tract",
                state="TX",
                county = c("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
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |                                                                      |   1%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |==                                                                    |   4%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |===                                                                   |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |===========                                                           |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  18%
  |                                                                            
  |===============                                                       |  21%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |============================================                          |  64%
  |                                                                            
  |=============================================                         |  65%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |===================================================================   |  95%
  |                                                                            
  |===================================================================== |  99%
  |                                                                            
  |======================================================================| 100%
#create a county FIPS code - 5 digit
sa_acs$county<-substr(sa_acs$GEOID, 1, 5)

#rename variables and filter missing cases
sa_acs2<-sa_acs%>%
  mutate(totpop= DP05_0001E, ppov=DP03_0119PE) %>%
#  st_transform(crs = 102740)%>%
  na.omit()
### find coordinate system of current map
st_crs(sa_acs2)
## Coordinate Reference System:
##   User input: NAD83 
##   wkt:
## GEOGCRS["NAD83",
##     DATUM["North American Datum 1983",
##         ELLIPSOID["GRS 1980",6378137,298.257222101,
##             LENGTHUNIT["metre",1]]],
##     PRIMEM["Greenwich",0,
##         ANGLEUNIT["degree",0.0174532925199433]],
##     CS[ellipsoidal,2],
##         AXIS["latitude",north,
##             ORDER[1],
##             ANGLEUNIT["degree",0.0174532925199433]],
##         AXIS["longitude",east,
##             ORDER[2],
##             ANGLEUNIT["degree",0.0174532925199433]],
##     ID["EPSG",4269]]
### create basic map
library(tmap)
library(tmaptools)

tm_shape(sa_acs2)+
  tm_polygons("ppov", title="% in Poverty", palette="Blues", style="quantile", n=5 )+
  tm_format("World", title="San Antonio Poverty Estimates - Quantile Breaks", legend.outside=T)+
  tm_scale_bar()+
  tm_compass()

### re-project map into South Central Texas projection
## 2278 = NAD 83 Texas South Central
new_sa<-st_transform(sa_acs2, crs = 2278)

## 3083 = NAD83 / Texas Centric Albers Equal Area
new_sa2<-st_transform(sa_acs2, crs = 3083)

## original data from get_acs
new_sa0<-sa_acs2

#NAD 83 TEXAS SOUTH CENTRAL
  #Extract two tracts
  twtr<-new_sa%>%
    filter(GEOID %in% c(48029181820, 48029110600))

  # get centroid coordinates for two tracts
  tr_co<-st_centroid(twtr)
## Warning in st_centroid.sf(twtr): st_centroid assumes attributes are constant
## over geometries of x
  #Measure feet apart
  dist<-st_distance(tr_co)

#NAD 83 TEXAS CENTRIC ALBERS EQUAL AREA
  #Extract two tracts
  twtr2<-new_sa2%>%
    filter(GEOID %in% c(48029181820, 48029110600))

  # get centroid coordinates for two tracts
  tr_co2<-st_centroid(twtr2)
## Warning in st_centroid.sf(twtr2): st_centroid assumes attributes are constant
## over geometries of x
  #Measure feet apart
  dist2<-st_distance(tr_co2)
  
#ORIGINAL ACS PULL - NAD 83 (EPSG:4269)
  #Extract two tracts
  twtr0<-new_sa0%>%
    filter(GEOID %in% c(48029181820, 48029110600))

  # get centroid coordinates for two tracts
  tr_co0<-st_centroid(twtr0)
## Warning in st_centroid.sf(twtr0): st_centroid assumes attributes are constant
## over geometries of x
## Warning in st_centroid.sfc(st_geometry(x), of_largest_polygon =
## of_largest_polygon): st_centroid does not give correct centroids for longitude/
## latitude data
  #Measure feet apart
  dist0<-st_distance(tr_co0)