【发布时间】:2017-06-11 18:01:10
【问题描述】:
我的任务是将大量 UTM 坐标(33 区)转换为经纬度 (WGS84) 坐标。这些位置应该位于挪威边境附近。我尝试使用 rgdal 包转换 R 中的坐标
#extracting some examples from data set
lat <- c(7790281, 7726438, 7266202, 7259480, 7271802)
long <- c(1053817, 1054025, 451754, 475228, 462235)
df <- data.frame(lat, long)
#converting from UTM33 to WGS84
library(rgdal)
tmp <- data.frame(coords.x = df$lat, coords.y = df$long)
coordinates(tmp) <-c("coords.x","coords.y")
proj4string(tmp) <- CRS("+proj=utm +zone=33 ellps=WGS84") #UTM zone 33
CRS.new <- CRS("+init=epsg:4326") # WGS84
coords <- spTransform(tmp,CRS.new)
#making a dataframe out of coordinates
coords <- data.frame(lat=coords@coords[,1], long=coords@coords[,2])
这会产生
lat long
1 69.19936 5.840162
2 68.92219 5.857922
3 66.55129 2.585804
4 66.52160 2.721701
5 66.58242 2.644578
但是,当使用在线转换工具 (http://www.rcn.montana.edu/resources/converter.aspx) 转换坐标时,我得到以下不同的结果
lat.corr long.corr
1 69.63112 29.37223
2 69.07562 29.00514
3 65.51455 13.95675
4 65.45688 14.46554
5 65.56618 14.18178
在同一张地图中绘制两个数据集时,可以清楚地看到用 rgdal 转换的点放错了位置。
如果我试图了解问题所在,但经过数小时的考虑和研究,我仍然无法找到它。非常有义务帮助找出问题所在!
编辑:它可能与跨越 UTM 区域边界的东坐标有关。会不会是 rgdal 有问题?
【问题讨论】:
标签: r coordinates gis coordinate-transformation rgdal