<- st_read(here::here("course-materials", "data", "week2-discussion", "Colombia", "Colombia.shp"))
col <- st_read(here::here("course-materials", "data", "week2-discussion", "RDLINE_colombia", "RDLINE_colombia.shp"))
roads <- readr::read_csv(here::here("course-materials", "data", "week2-discussion", "dataves.csv")) %>%
aves ::as_tibble() %>%
dplyr::rename(long = decimal_longitude) %>%
dplyr::mutate(lat = decimal_latitude) %>%
dplyrst_as_sf(coords = c("long", "lat"), crs = 4326)
Read in Vector Data
<- st_read(here::here("data", "week2-discussion", "Colombia", "Colombia.shp"))
col <- st_read(here::here("data", "week2-discussion", "RDLINE_colombia", "RDLINE_colombia.shp"))
roads <- readr::read_csv(here::here("data", "week2-discussion", "dataves.csv")) %>%
aves ::as_tibble() %>%
dplyr::rename(long = decimal_longitude) %>%
dplyr::mutate(lat = decimal_latitude) %>%
dplyrst_as_sf(coords = c("long", "lat"), crs = 4326)
Check Class and Geometry Type
class(col)
class(roads)
class(aves)
unique(st_geometry_type(col))
unique(st_geometry_type(roads))
unique(st_geometry_type(aves))
filter()
for Macro Region of Interest
<- col %>%
col_andean ::mutate(N1_MacroBi = as.factor(N1_MacroBi)) %>%
dplyr::filter(N1_MacroBi == "Andean")
dplyr
class(col_andean)
tm_shape(col_andean) +
tm_polygons()
Coordinate Reference System
st_crs(col)
st_crs(roads)
st_crs(aves)
st_crs(col)$units
st_crs(roads)$units
st_crs(aves)$units
<- aves %>%
aves_df_purrr mutate(lon = unlist(purrr::map(aves$geometry, 1)),
lat = unlist(purrr::map(aves$geometry, 2))) %>%
st_drop_geometry()
<- aves %>%
aves_df_st_coords ::mutate(lon = sf::st_coordinates(.)[,1],
dplyrlat = sf::st_coordinates(.)[,2]) %>%
st_drop_geometry()
<- aves %>%
aves_df_purrr st_as_sf(coords = c("lon", "lat"), crs = 4326)
Bring All Vector Data Types Together
st_crs(col) == st_crs(roads)
<- st_transform(aves, crs = st_crs(col))
aves
tm_shape(col) +
tm_polygons() +
tm_shape(roads) +
tm_lines() +
tm_shape(aves) +
tm_dots()