4.1 Reading and writing spatial objects with sf
and raster
Spatial data are encoded in various GIS file formats
such as Shapefiles (.shp), Geodatabase (.gdb), GeoPackage (.gpkg) and GeoJSON (.geojson),
GeoTIFF (.tiff). In this post we show how to read commonly used formats and
import the data they include in you R session. We start by describing the steps
to turn a set of coordinates included in a .csv
file into a spatial object and
write it to a GIS file format. We then exemplify the use of two functions:
st_read()
from the sf
package and raster()
from the raster
package and
import different GIS file available on the Portail de données ouvertes de
Montreal.
Let us start by loading the packages required: