You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用ggOceanMaps绘制阿拉斯加水深图时地图倒置的问题求助

解决ggOceanMaps绘制阿拉斯加区域水深图倒置的问题

你的问题出在研究区域靠近国际日期变更线,ggOceanMaps默认的坐标处理逻辑在这类跨日界线的西经区域容易出现地图倒置。以下是两种可行的修正方案:

方案一:指定投影中心经度

通过设置basemap和transform_coord的lon_0参数为研究区域的中心经度(你的区域中心是-168),让投影以目标区域为中心展开,避免坐标循环导致的翻转:

library(ggOceanMaps)
library(terra)

dt <- data.frame(lon = c(-172, -172, -164, -164), lat = c(57, 52, 52, 57))

basemap(data = dt, bathymetry = TRUE, lon_0 = -168) + 
  geom_polygon(data = transform_coord(dt, lon_0 = -168), aes(x = lon, y = lat), 
               fill = NA, color = "red")

方案二:转换经度为东经范围

将西经坐标转换为东经(加360),让经度落在连续的180-360范围内,绕开-180到180的经度循环问题:

library(ggOceanMaps)
library(terra)

# 西经转东经
dt <- data.frame(lon = c(-172+360, -172+360, -164+360, -164+360), lat = c(57, 52, 52, 57))

basemap(data = dt, bathymetry = TRUE) + 
  geom_polygon(data = transform_coord(dt), aes(x = lon, y = lat), 
               fill = NA, color = "red")

两种方案都能解决地图倒置的问题,你可以根据自己的后续分析需求选择其中一种。

内容的提问来源于stack exchange,提问作者Patricia Schilling

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.01 20:04:51