Skip to content

SOseg for hauls #77

@mdsumner

Description

@mdsumner

Just a concept

SOseg <- function(x0, y0, x1, y1, target = NULL, ..., source = NULL, add = TRUE) {
  s1 <- SOproj(cbind(x0, y0), target = target, source = source)
  s2 <- SOproj(cbind(x1, y1), target = target, source = source)
  if (!add)   plot(rbind(s1, s2), type = "n", asp = 1)
  segments(s1[,1], s1[,2], s2[,1], s2[,2], ...)
}

EG: 

SOmap_auto(eez_poly, target = "laea")
SOseg(lon1, lat1, lon2, lat2)

This is kinda promising (using plusraster) and ggplot2, perhaps we can adapt to SOmap

library(SOmap)
#SOmap_auto(x$`Start Haul Lon`, x$`Start Haul Lat`, input_lines = FALSE)


ex <- extent(range(x$`Start Haul Lon`), range(x$`Start Haul Lat`)) + 1
library(raadtools)
topo <- readtopo("gebco_14", xylim = ex)
cols <- c("#54A3D1","#60B3EB","#78C8F0","#98D1F5","#B5DCFF","#BDE1F0","#CDEBFA","#D6EFFF","#EBFAFF","grey92","grey94","grey96", "white")
ramp2 <- grDevices::colorRampPalette(head(cols, -4))
bluepal<-ramp2(length(brks)-1)
topo <- clamp(topo, c(-6000, 0))
brks <- seq(0, -6000, by = -500)
library(palr)
im <- image_raster(topo, col = bluepal, breaks = brks)
library(plusraster)
library(ggplot2)
ggplot(x, aes(x = `Start Haul Lon`, y = `Start Haul Lat`,
              xend = `End Haul Lon`, yend = `End Haul Lat`,
              colour = `Haul Start (UTC)`)) +
  
  plus_raster(im) + 
geom_segment() + coord_fixed(1/sin(54 * pi/180)) + 
  xlim(xmin(topo), xmax(topo)) + ylim(ymin(topo), ymax(topo))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions