如何将地图图和连接图与 r 中的栅格化图像对齐?

How to align a map plot and connection plot with a rasterized image in r?

如何使这张地图及其点与我的图像对齐? [1]: https://i.stack.imgur.com/d6WRc.png

earth <- file.choose()
earth <- readJPEG(earth, native=TRUE)
par(mar=c(360,360,360,360))
grid.raster(earth)
maps:: map(add=TRUE)
points(x=cldrd$longitude, y=cldrd$latitude, col=c("magenta"), cex=(.7), pch=16)    
points(x=outlrd$longitude, y=outlrd$latitude, col=c("black"), cex=(.2), pch=16)
inter <- gcIntermediate(c(10.451526,51.165691), c(-96.8410503,32.8143702), n=100, addStartEnd=TRUE, breakAtDateLine=F)
lines(inter, col=c("#00ffbf"), lwd=.05)

读取图像并对其进行地理配准(最好从地理配准数据开始,有很多事情要做)

library(terra)
f <- "https://i.stack.imgur.com/d6WRc.png"
earth <- rast(f)
# eyeballing
ext(earth) <- c(-180, 180, -145, 145)
plotRGB(earth)

图像太暗,我想我应该添加一些方向线

w <- geodata::world(path=".")
lines(w, col="gray")

现在你的坐标

crds <- rbind(c(10.451526,51.165691), c(-96.8410503,32.8143702))
points(crds, pch=20, col="red", cex=2)

library(geosphere)
inter <- gcIntermediate(crds[1,], crds[2,], n=100, addStartEnd=TRUE)
lines(inter, col="#00ffbf", lwd=2)