revere2323
revere2323

Reputation: 37

R package sf | Conversion from NAD83 is not working

I want to plot specific points (stores) and see if they are in a buffer around schools in St. Louis, MO.

For whatever reason, I am not getting a clear conversion for the stores (at least the dots are not showing up) on the following example.

The coordinates for the stores are described as: "The XCoord and YCoord fields are X- and Y-coordinates of the I/Leads store location and in State Plane North American Datum 1983 (NAD83) format. This is a standard coordinate system for displaying regional/local geographic data in any desktop mapping application. " This is for St. Louis in MO.

Two data points for the stores:

XCoord   |   YCoord

900378.4 | 1033497

882296.1 | 1034238

Here is my code:

county.sf <- get_acs(state = "MO",
                 county = c("St. Louis County", "St. Louis City"),
                 geography = "tract",
                 variables = "B03002_001", 
                 output="wide", 
                 geometry = TRUE) %>%
sf::st_transform(crs = "ESRI:102003")

school <- read.csv("C:\\file1.csv")
school.sf <- st_as_sf(school, coords = c("long", "lat"), crs = "epsg:4326") 
school.sf.utm <- st_transform(school.sf, crs = "ESRI:102003")

#^^^This all works fine and graphs with appropriate buffer

store <- import("C:file2.csv")
store.sf <- st_as_sf(store, coords = c("XCoord", "YCoord"), crs ="epsg:6512") 
store.sf.utm <- st_transform(store.sf, crs = "ESRI:102003")

#These points are not showing up. There is more code but I think it is this code ^^^ that is wrong. 6512 is supposedly MO East, but something is wrong.

Upvotes: 0

Views: 641

Answers (1)

revere2323
revere2323

Reputation: 37

After a lot of experimentation, i've found the correct code is "ESRI:102696" instead of "espg:6512."

Upvotes: 1

Related Questions