@@ -282,12 +282,18 @@ if (nrow(catch) > 0) {
282282
283283# Prepare catch data for plotting ----------------------------------------------
284284# Select and rename trawl data for pie charts
285- catch.pie <- cluster.summ.wt %>%
285+ haul.pie <- haul.summ.wt %>%
286+ select(haul, long, lat, any_of(names(pie.spp))) %>%
287+ st_as_sf(coords = c("long","lat"), crs = crs.geog)
288+
289+ # Select and rename trawl data for pie charts
290+ cluster.pie <- cluster.summ.wt %>%
286291 select(cluster, long, lat, any_of(names(pie.spp))) %>%
287292 st_as_sf(coords = c("long","lat"), crs = crs.geog)
288293
289294# Project pie data
290- catch.pie <- project_sf(catch.pie, crs.proj)
295+ haul.pie <- project_sf(haul.pie, crs.proj)
296+ cluster.pie <- project_sf(cluster.pie, crs.proj)
291297
292298# Convert haul data for plotting
293299haul.catch <- haul.summ.wt %>%
@@ -347,7 +353,22 @@ cluster.locs.sf <- cluster.mid %>%
347353 st_as_sf(coords = c("long","lat"), crs = crs.geog)
348354
349355# Convert haul catch to sf and create labels
350- cluster.catch.sf <- catch.pie %>%
356+ haul.catch.sf <- haul.pie %>%
357+ st_as_sf(coords = c("X","Y"), crs = crs.proj) %>%
358+ st_transform(crs = crs.geog) %>%
359+ mutate(
360+ label = paste("Haul", haul),
361+ popup = paste('<b>Haul:', haul, '</b><br/>',
362+ 'Anchovy:', Anchovy, 'kg<br/>',
363+ 'P. Sardine:', Sardine, 'kg<br/>',
364+ 'J. Sardine:', JapSardine, 'kg<br/>',
365+ 'Jack Mackerel:', JackMack, 'kg<br/>',
366+ 'P. herring:', PacHerring, 'kg<br/>',
367+ 'P. mackerel:', PacMack, 'kg<br/>',
368+ 'All CPS:', AllCPS, 'kg'))
369+
370+ # Convert cluster catch to sf and create labels
371+ cluster.catch.sf <- cluster.pie %>%
351372 st_as_sf(coords = c("X","Y"), crs = crs.proj) %>%
352373 st_transform(crs = crs.geog) %>%
353374 mutate(
@@ -1933,12 +1954,21 @@ if (exists("nav.paths.sf")) {
19331954 popup = ~popup, label = ~label,
19341955 group = "Trawls-Salmon")
19351956
1957+ # Add trawl cluster data
1958+ if (exists("haul.catch.sf"))
1959+ i.map <- i.map %>%
1960+ # Add trawl catch
1961+ addCircleMarkers(data = haul.catch.sf, radius = 5, color = "#000000", stroke = TRUE, weight = 2,
1962+ opacity = 0.8, fillOpacity = 1, fillColor = "white",
1963+ popup = ~popup, label = ~label,
1964+ group = "Trawls")
1965+
19361966 # Add trawl cluster data
19371967 if (exists("cluster.catch.sf"))
19381968 i.map <- i.map %>%
19391969 # Add trawl catch
19401970 addCircleMarkers(data = cluster.catch.sf, radius = 5, color = "#000000", stroke = TRUE, weight = 2,
1941- opacity = 0.8, fillOpacity = 1, fillColor = "white ",
1971+ opacity = 0.8, fillOpacity = 1, fillColor = "magenta ",
19421972 popup = ~popup, label = ~label,
19431973 group = "Trawls")
19441974
0 commit comments