-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_districts.R
51 lines (38 loc) · 1.71 KB
/
prepare_districts.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -------------------------------------
# Script: prepare_districts.R
# Author: Michal Kvasnička
# Purpose: This script creates/updates districts (okresy now). It reads them
# from a shape file(s) and transforms them to Křovák CRS.
# Inputs: a shape file of political districts in the Czech Republic, profiles,
# and log file
# Outputs: sf tibble districts (saved on disk)
#
# Copyright(c) Michal Kvasnička
# -------------------------------------
# TEMP: remove
# supply path to RSCRIPTDIR if it was not supplied outside
if (!exists("RSCRIPTDIR")) RSCRIPTDIR <- "."
# supply path to folder where user stores her config and profile
if (!exists("DIR_ORIGIN")) DIR_ORIGIN <- "data"
# source necessary scripts
source(file.path(RSCRIPTDIR, "functions_auxiliary.R"))
source(file.path(RSCRIPTDIR, "functions_districts_preparation.R"))
# read user config/profiles
profiles <- read_profiles()
# create major districts table
create_districts(path_to_districts = path_to_districts(),
path_to_raw_districts = path_to_raw_districts(),
profiles = profiles)
# create a modified version of districts for shiny
create_districts(path_to_districts = path_to_shiny_districts(),
path_to_raw_districts = path_to_raw_districts(),
profiles = profiles,
shiny = TRUE)
# create ORPs for shiny
create_orps(path_to_orps = path_to_shiny_orps(),
path_to_raw_districts = path_to_raw_districts(),
profiles = profiles)
# create the whole state polygon
create_state_polygon(path_to_state_polygon = path_to_state_polygon(),
path_to_raw_districts = path_to_raw_districts(),
profiles = profiles)