Hi Chris,
The pointer on moving
raster::as.matrix(rr_ra)[i,j] out of the loop was a great one. Masking now takes seconds rather than minutes/hours, and i am able to loop the code and mask multiple KDEs in a matter of seconds.
Thanks also for adding shapefile support to plot telemetry, this will be really useful for sharing results with colleagues quickly. Unfortunately, I am getting a warning when plotting and the shapefile does not plot
plot(AKDE[[1]], level.UD=c(0.5, 0.95), SP = SP, units=TRUE)
WARNINGS:
1: In plot.window(...) : "SP" is not a graphical parameter
2: In plot.xy(xy, type, ...) : "SP" is not a graphical parameter
3: In axis(side = side, at = at, labels = labels, ...) :
"SP" is not a graphical parameter
4: In axis(side = side, at = at, labels = labels, ...) :
"SP" is not a graphical parameter
5: In box(...) : "SP" is not a graphical parameter
6: In title(...) : "SP" is not a graphical parameter
7: In graphics::segments(x0 = X[j, 1], y0 = Y[j, 1], x1 = last(X[j, ... :
"SP" is not a graphical parameter
There are over fifty warnings. However, by reconstructing the script from the code in the plot.telemetry() function (below) I can get the maps that I am looking for. Do you think the issues that are ocurring above is an issue on my end?
SP <- SB_land
PROJ <- "+proj=tpeqd +lat_1=-25.7199142494061 +lon_1=113.634047157365 +lat_2=-25.8607177794747 +lon_2=113.748002084076 +x_0=0 +y_0=0 +datum=WGS84 +units=km +no_defs" # changethe projection to units = km (this is automatically done in plot.telemetry)
SP <- sp::spTransform(SP,CRSobj=PROJ)
sp::plot(SP,col="grey25",border = "black", add=TRUE)
Finally I have been using the compass() function, but have found that when printing a pdf the function has a number of warnings related to the arrow graphic (1: In text.default(x, y, labels = "<U+27A2>", adj = c(0.5, ... :
conversion failure on '➢' in 'mbcsToSbcs': dot substituted for <e2>) and the output pdf has a dotted line instead of the arrow.
Cheers,
Mike