Closed lidefi87 closed 8 months ago
uh yes, good idea I'll do this 🤘
Amazing! Thanks for that 😊
actually it already does use sf and terra, but "it's complicated" - what actual features are most important? i.e. should we accept sf and terra objects to functions, or return them? if you could tell me which functionality you see where it should be terra I'll do that first and it might not take much.
I am looking at updating this notebook here: https://github.com/SCAR/EGABIcourse19/blob/master/50_Mapping.Rmd
There is a section called SOmap
showing how to use this package. One of the things it does is plot a raster over a stereographic map. Maybe it would be easier to transform SOmap
outputs into ggplot
objects as it is shown further down the notebook. I noticed this feature after I posted here.
it's going ok to accept terra objects in SOmap_auto(), SOplot(), and SOproj() - I just convert them to raster or to sf and let it go.
I think sf is already supported enough?
there were some fixes needed for the background data too which should be ok.
it's a bit of mess now, and a few things I have figured out how to do better but not sure when we'll get to a full review. Can you try out the changes with
devtools::install_github("AustralianAntarcticDivision/SOmap@terra-1")
here's how I would create that fake raster with terra:
library(terra)
xr <- rast(ext(99.875, 140.125, -65.05, -44.95), res = c(0.25, 0.1), crs= "OGC:CRS84")
xr <- setValues(temp, sqrt((xFromCell(temp, 1:ncell(temp)) - 120)^2/3 + (yFromCell(temp, 1:ncell(temp)) - -40)^2/5))
ellie <- SOmap_data$mirounga_leonina
## construct and plot the map
SOmap_auto(ellie$lon, ellie$lat)
SOmap_auto(ellie$lon, ellie$lat, input_points = FALSE, input_lines = FALSE)
SOmap_auto(xr)
SOmap_auto(xr)
my_cmap <- colorRampPalette(c("#4D4140", "#596F7E", "#168B98",
"#ED5B67", "#E27766", "#DAAD50", "#EAC3A6"))(51)
SOplot(xr, col = my_cmap)
SOproj() is a bit weird in that it will return a raster or sf for rast or vect, but again this should be unpicked so that a general tool handles all the formats and SOmap uses that (or something)
Amazing! I am at a conference this week, but I will trying this when I get back home next week. I will let you know how it goes. Thanks!
Not sure if part of this issue, or a new one, but there seems to be a SOmap dependency on rgdal, which is no longer available. Got around it by downloading and installing an archived version of rgdal...
oops, that's on me, will try to fix next week - happy to help with rgdal if anyone else needs
Hey @mdsumner How did you go with this? I tried to install it for Luke Brokensha and its still throwing rgdal issues.
Cheers, Dale
keep prodding me I'll get to it
... I'll get this
I think this immediate need is fixed :)
There will be a broader rewrite, but there's too many balls to juggle atm.
Please submit new issues for specifics. Thanks!
Hi there,
When installing
SOmap
, I noticed that it depends onsp
andraster
. I was wondering if there are any plans to update dependencies tosf
andterra
.I am interested in this because I may be using this as part of a tutorial and I am trying to find out if it would be still good to keep this package in the content, or remove it.
Thanks!