Session Ready
Exercise

Vector and raster coordinate systems

In order to perform any spatial analysis with more than one layer, your layers should share the same coordinate reference system (CRS) and the first step is determining what coordinate reference system your data has. To do this you can make use of the sf function st_crs() and the raster function crs().

When the geographic data you read in with sf already has a CRS defined both sf and raster will recognize and retain it. When the CRS is not defined you will need to define it yourself using either the EPSG number or the proj4string.

Instructions
100 XP
  • Use st_crs() to identify if a CRS exists and what it is for the trees and neighborhoods objects.
  • Use the st_crs() function to define/assign a CRS to the trees object.
  • Use crs() to identify if a CRS exists and what it is for the canopy and manhattan objects.
  • Use the crs() function to define/assign a CRS to the manhattan object.