Skip to contents

Reads a vector map (e.g., shapefile) that is intended to be corrected.

Usage

read_map(shp_path, crs = NA)

Arguments

shp_path

A character string specifying the path to the input map file (e.g., a shapefile).

crs

An optional coordinate reference system (CRS) to assign if the input file lacks one. Can be an EPSG code (e.g., 32632) or a WKT string.

Value

An sf object of the map to be corrected.

Details

This function reads the geospatial file using sf::st_read. If the file contains polygon geometries and does not already have an area column named 'area_old', this function will calculate the area of each feature and add it.

Examples

if (FALSE) { # \dontrun{
# First, create a demo shapefile
demo_files <- create_demo_data()

# Read the map that needs correction
map_to_correct <- read_map(shp_path = demo_files$shp_path)

# The output is now ready to be used in the `correct_map()` function
# after a model has been trained.
plot(sf::st_geometry(map_to_correct))
} # }