Rspatial:变换地图投影spTransform / st_transform交换轴

问题描述

尊敬的编码社区,

如何防止spTransform / st_transform交换轴?使用set_enforce_xy或st_axis_order无效。我的代码在R = 4中工作。

library(sf)
library(dplyr) # %>%
map <- st_read("shp","K4fozo20160101gf_ch2007poly")
map %>% st_geometry %>% plot

Shapefile with proper geometry

st_transform(map,21781) %>% st_geometry %>% plot

Wrong geometry after transformation

为什么变换会导致几何图形错误

使用以下代码得到相同的结果:

library(rgdal)
map <- readOGR(dsn="shp",layer="K4fozo20160101gf_ch2007poly")
plot(map)
spTransform(map,CRS(SRS_string='epsg:21781')) %>% plot

如何避免错误的转换?

我目前的设置: R版本4.0.2, 平方英尺:0.9-6 (GEOS 3.8.0,GDAL 3.0.4,PROJ 6.3.1), rgdal:1.5-16, sp:1.4-2

You can get my shapefile using this link

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)