0

提前致谢。

我有 86,000 个纬度/经度点需要转换为 UTM。此处包含 25 个样本。我找到了许多帮助完整的 SO 帖子,但继续收到有关工作示例的错误,如下所述。

样本数据在这里:

    locs <- structure(list(LocNum = 1:25, IndID = structure(c(1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 3L, 3L, 3L, 3L, 3L), .Label = c("011_A", "015_A", "034_A"
), class = "factor"), FixDateTimeLocal = structure(1:25, .Label = c("2012-02-16 17:00:00", 
"2012-02-16 23:00:00", "2012-02-17 05:00:00", "2012-02-17 11:00:00", 
"2012-02-17 17:00:00", "2012-02-17 23:00:00", "2012-02-18 05:00:00", 
"2012-02-18 11:00:00", "2012-02-18 17:00:00", "2012-02-18 23:00:00", 
"2012-02-27 14:00:00", "2012-02-27 15:30:00", "2012-02-27 16:00:00", 
"2012-02-27 17:00:00", "2012-02-27 23:00:00", "2012-02-28 05:00:00", 
"2012-02-28 11:00:00", "2012-02-28 17:00:00", "2012-02-28 23:00:00", 
"2012-02-29 05:00:00", "2013-01-19 17:00:00", "2013-01-19 23:00:00", 
"2013-01-20 05:00:00", "2013-01-20 11:00:00", "2013-01-20 17:00:00"
), class = "factor"), Lat = c(45.120814, 45.120802, 45.120761, 
45.116529, 45.105876, 45.104819, 45.104803, 45.104491, 45.103639, 
45.10427, 45.092519, 45.094687, 45.098596, 45.099671, 45.099709, 
45.099422, 45.097036, 45.097139, 45.098102, 45.098099, 44.962221, 
44.962904, 44.967558, 44.968786, 44.973531), Long = c(-110.817359, 
-110.817405, -110.818067, -110.806221, -110.797895, -110.796213, 
-110.795224, -110.795689, -110.799264, -110.799369, -110.783507, 
-110.78943, -110.791256, -110.794017, -110.794075, -110.794205, 
-110.792251, -110.792, -110.791296, -110.791331, -109.85984, 
-109.859536, -109.860217, -109.86568, -109.881313)), .Names = c("LocNum", 
"IndID", "FixDateTimeLocal", "Lat", "Long"), row.names = c(NA, 
-25L), class = "data.frame")

有 3 个人的 ID、时间戳(还不是 POSIXct)、纬度和经度。

  LocNum IndID    FixDateTimeLocal      Lat      Long
1      1 011_A 2012-02-16 17:00:00 45.12081 -110.8174
2      2 011_A 2012-02-16 23:00:00 45.12080 -110.8174
3      3 011_A 2012-02-17 05:00:00 45.12076 -110.8181
4      4 011_A 2012-02-17 11:00:00 45.11653 -110.8062
5      5 011_A 2012-02-17 17:00:00 45.10588 -110.7979
6      6 011_A 2012-02-17 23:00:00 45.10482 -110.7962

我遵循了此处提出的建议并使用了以下代码:

library(sp)
library(rgdal)
pts <- SpatialPoints(cbind(locs$Lat,locs$Long), 
                     proj4string = CRS("+proj=longlat +datum=WGS84"))

并得到

Error in validityMethod(as(object, superClass)) : 
  Geographical CRS given to non-conformant data: -110.818067

为了按照这里的建议删除负数,我跑了

pts <- SpatialPoints(abs(cbind(locs$Lat,locs$Long)), 
                     proj4string = CRS("+proj=longlat +datum=WGS84"))

并得到

Error in validityMethod(as(object, superClass)) : 
  Geographical CRS given to non-conformant data: 110.818067

最后,正如这里使用我运行的矩阵所建议的那样

pts <- project(as.matrix(locs[,c("Lat","Long")]), "+proj=utm +zone=12 ellps=WGS84")

并得到

Warning message:
In project(as.matrix(locs[, c("Lat", "Long")]), "+proj=utm +zone=12 ellps=WGS84") :
  25 projected point(s) not finite

任何关于如何将这些纬度/经度点转换为 UTM 的建议将不胜感激。纬度/经度在 WGS84 中,我的 UTM 区域是 12。

4

0 回答 0