-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path3_build.R
62 lines (54 loc) · 1.55 KB
/
3_build.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
52
53
54
55
56
57
58
59
60
61
62
# Build an SVG using XML components
source("3_build/src/svg_xml_helpers.R")
p3_targets <- list(
tar_target(
root_svg,
init_svg("3_build/tmp/root.svg",
viewbox_dims = c(0, 0, svg_width=svg_width, svg_height=700)),
format = "file"
),
# Add states
# TODO: groups don't seem to actually be working
tar_target(
state_paths_svg,
add_poly_group_to_svg(
out_svg = "3_build/tmp/state_paths.svg",
in_svg = root_svg,
grp_id = "conus_states",
paths = p2_conus_states_paths,
path_ids = p2_conus_states_names,
path_class = rep("state", length(p2_conus_states_paths))),
format = "file"
),
# Add in HUCs
tar_target(
huc8s_paths_svg,
add_poly_group_to_svg(
out_svg = "3_build/tmp/huc8s_paths.svg",
in_svg = state_paths_svg,
grp_id = 'hucs',
paths = p2_huc8s_paths,
path_ids = p0_huc8_grps,
path_class = rep("huc8", length(p2_huc8s_paths))),
format = "file"
),
# Add in rivers
tar_target(
river_paths_svg,
add_poly_group_to_svg(
out_svg = "3_build/tmp/river_paths.svg",
in_svg = huc8s_paths_svg,
grp_id = 'rivers',
paths = p2_river_paths,
path_ids = sprintf("comid_%s", needs_a_solution$comid),
path_class = sprintf("%s order_%s",
rep("river", length(p2_river_paths)),
needs_a_solution$streamorde)),
format = "file"
),
tar_target(
map_svg,
build_final_svg("3_build/out/map.svg", river_paths_svg),
format = "file"
)
)