R:穿过经度( - )180的SpatialPolygon的变换坐标系

问题描述 投票:0回答:1

我创建了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')

enter image description here

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

r coordinate-transformation sp
1个回答
0
投票

在问过类似的问题之后我才发现了这个问题。在那里,@ Humpelstielzchen使用suggested to me来使用st_wrap_dateline()-package中的sf,它似乎按预期工作。

© www.soinside.com 2019 - 2024. All rights reserved.