Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOseg for hauls #77

Open
mdsumner opened this issue May 27, 2020 · 1 comment
Open

SOseg for hauls #77

mdsumner opened this issue May 27, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@mdsumner
Copy link
Member

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))
@mdsumner mdsumner added the enhancement New feature or request label May 27, 2020
@Maschette
Copy link

Looks promising!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants