【问题标题】:R: transform coordinate system of SpatialPolygon that crosses longitude (-)180R: 跨经度 (-)180 的 SpatialPolygon 变换坐标系
【发布时间】:2018-09-07 07:03:36
【问题描述】:

我创建了具有 CRS = UTM 的多边形(请参阅here),我需要将其转换为纬度/经度。我的一些多边形穿过日期变更线,这会导致转换创建一个穿过整个地球的多边形。

library(sp)
library(rgeos)

points <- data.frame(x = c(-179.5, 0), y = c(-50, -30))
coordinates(points) <- ~x+y
proj4string(points) <- '+init=epsg:4326'

points_sp <- spTransform(points, CRS('+init=epsg:32621')) # wrong zone, but ignored for example
# expand point to circle
circles <- gBuffer(points_sp, width = 1e+5)
# transform back to WGS84
circles_latlon <- spTransform(circles, CRS(proj4string(points)))

par(mfrow = c(1, 2))
plot(circles, axes = TRUE, main = 'UTM')
plot(circles_latlon, axes = TRUE, main = 'WGS84')

是否有分割多边形的解决方案?或者解决日期问题的替代解决方案?

【问题讨论】:

    标签: r coordinate-transformation sp


    【解决方案1】:

    我在问了一个类似的问题后才发现这个问题。 @Humpelstielzchen 的 suggested to me 使用来自 sf-package 的 st_wrap_dateline(),到目前为止,它似乎可以按预期工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-15
      • 1970-01-01
      • 2021-02-02
      • 2021-07-19
      相关资源
      最近更新 更多