set_projection: Set Projection

set_projectionR Documentation

Set Projection

Description

Set the projected coordinate reference system of the project based on the extent of the boundary shapefile.

Usage

set_projection(
  mainPath,
  location,
  mostRecent = FALSE,
  alwaysSet = FALSE,
  bestCRS = FALSE,
  allowInteractivity = TRUE,
  testMode = FALSE
)

Arguments

mainPath

character; the parent directory of the location folder

location

character; the location folder name

mostRecent

logical; should the most recent downloaded boundary shapefile be selected? If FALSE and if there are multiple available inputs, the user is interactively asked to select the input based on download time.

alwaysSet

logical; should the projected coordinate reference system always be set, even if it has already been set? If FALSE and if the projected coordinate reference system has already been set the user is interactively asked whether they want to set it again or not.

bestCRS

logical; should the projected coordinate reference system be set automatically based on the "best-fit" projected coordinate reference system? If FALSE, the user is interactively asked to select the projected coordinate reference system from a list of suitable reference systems.

allowInteractivity

logical; if TRUE, the user can choose a label for the processed boundary shapefile that is created when setting up the projection of the project. If FALSE, the default label is used ('pr').

testMode

logical; used for testing. If TRUE labels of processed inputs are not interactively asked.

Details

The "best-fit" and the suitable projected coordinate reference systems are obtained with the suggest_top_crs and the suggest_crs, respectively, from the crsuggest package. Both function work by analyzing the extent of the spatial dataset and comparing it to the area extents in the EPSG's coordinate reference system database.

Examples

# Replace workDir with the actual path to your working directory
## Not run: 
mainPath <- "workDir"
initiate_project(mainPath)
## End(Not run)

# Replace myLocation with the location name you are working on (workDir subfolder)
## Not run: 
location <- "myLocation"
download_boundaries(mainPath, location, adminLevel = 1, type = "gbOpen", alwaysDownload = TRUE)
set_projection(mainPath, location, mostRecent = TRUE, alwaysSet = TRUE, bestCRS = TRUE)
## End(Not run)

ptimoner/inAccMod documentation built on Jan. 27, 2025, 9:34 a.m.