I have a PNG image wich I have opened in R and in order to give coordinations converted into a SpatRast object with the following code:
library(terra)
r <- rast("yanomamis.png")
#Warning: [rast] unknown extent
## drop the alpha channel
r <- r[[1:3]]
## declare the R,G,B channels
RGB(r) <- 1:3
ext(r) <- c( -70.18066, -55.6897, -0.5009, 4.89839 )
crs(r) <- "+proj=longlat +datum=WGS84"
Which resulted in:
r
#class : SpatRaster
#dimensions : 503, 1328, 3 (nrow, ncol, nlyr)
#resolution : 0.01091187, 0.01073417 (x, y)
#extent : -70.18066, -55.6897, -0.5009, 4.89839 (xmin, xmax, ymin, ymax)
#coord. ref. : +proj=longlat +datum=WGS84 +no_defs
#source : yanomamis.png
#colors RGB : 1, 2, 3
#names : yanomamis_1, yanomamis_2, yanomamis_3
My goal is to draw over this plot and save the drawing as a shape file, which I thought I could accomplish with the function draw
from the terra package.
However, when I try to execute the code, Im not able to draw anything over the plot.
Can anyone see what am I missing?