##Title: DWVGIS 2. DMAs.R
#Author: Jack Reilly
#Purpose: Illustrate loading an internal shape file (luxembourg) and and an external shape file (dma_export.shp)
#Requires: the dma_export folder (dma_export.shp with its .shx, .dbf, .prj and .cpg files), in ~/desktop/working/dwv26;
#  download them from the Course Drive

library(sf)
library(terra)
library(tidyverse)

#Set the working directory
setwd("~/desktop/working/dwv26")

#Identify the path to the internal luxembourg data
filename <- system.file("ex/lux.shp", package="terra")
filename

#Load and draw the data
lux <- vect(filename)
class(lux)
plot(lux)

#Read and plot dma_export.shp
dmas <- st_read("dma_export/dma_export.shp")
plot(dmas)

#Show the filetypes supported by st_read
st_drivers()