Geographic Information Systems Asked by Naomi Tinga on January 22, 2021
I have lat longs and want R to return a column of the neighborhood tabulation area for each point;
lat long NTA
40.79127 -73.96484 Morningside Heights
40.72622 -73.98380 East Village
40.79196 -73.96809 Upper West Side
You are looking for an spatial join, after converting your lat-longs to a spatial object. This is done easily with package sf
, replace the filenames with yours on the following code:
library(sf)
library(dplyr)
lat_longs = read.csv(latlongs.csv) %>%
st_as_sf(coords = c("longitude_column", "latitude_column")) %>%
st_set_crs(4326) # coordinate reference system is lat-long
NTA = read_sf("nta_polygons.shp")
lat_longs_NTA = lat_longs %>% st_join(NTA)
Answered by Elio Diaz on January 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP