3

G'day,
我有大量的经纬度坐标,它们位于 CRS 澳大利亚大地基准 66/84(简称 AGD66)中。我想将这些坐标从 AGD66 更改为 WGS84,因为它们之间大约有 200m 的差异,而且我在 WGS84 中有其他坐标和图层。我试图通过以下方式做到这一点:

lon        lat
147.1428   -43.49083

library(rgdal)
pts<-read.table(file.choose(),header=TRUE,sep=',')  
# I first project the pts in their original CRS
pts66<-project(cbind(pts$lon,pts$lat), "+init=epsg:4202")
# Then to transform it to WGS84
pts84 = spTransform(pts66,CRS("+init=epsg:3033"))

Error in function (classes, fdef, mtable)  : 
unable to find an inherited method for function "spTransform", for signature "matrix", "CRS"

有谁知道我为什么会收到此错误或对如何将这些坐标从 AGD66 更改为 WGS84 有任何建议?提前感谢您的帮助。

干杯,
亚当

4

1 回答 1

6

我删除了部分错误答案

函数 project() 不能进行数据转换,所以你可能有问题,我认为你有什么是错误的。

问题是您只能在 WGS84 上从/到 longlat 进行 project(),因此您第一次使用 project 是不正确的。如果我猜对了,您的坐标位于 AGD66 中,因此您必须先分配该投影,然后才能进行变换。您不能使用 project() 进行基准面转换,但 spTransform() 可以。

我认为你需要这个:

pts = read.table(text = "lon        lat
147.1428   -43.49083", header = TRUE)

## assign original coordinate system
pts66 = SpatialPoints(cbind(pts$lon,pts$lat), CRS("+init=epsg:4202"))

## Then to transform it to WGS84
pts84 = spTransform(pts66, CRS("+init=epsg:3033"))


pts66
SpatialPoints:
     coords.x1 coords.x2
[1,]  147.1428 -43.49083
Coordinate Reference System (CRS) arguments: +init=epsg:4202 +proj=longlat +ellps=aust_SA
+no_defs 

pts84
SpatialPoints:
     coords.x1 coords.x2
[1,]  11126605   2971806
Coordinate Reference System (CRS) arguments: +init=epsg:3033 +proj=lcc +lat_1=-68.5     +lat_2=-74.5
+lat_0=-50 +lon_0=70 +x_0=6000000 +y_0=6000000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs
+towgs84=0,0,0 

这意味着 pts66 不会从其原始值更改,但它们具有正确的元数据,可用于将它们转换为您的目标的下一步(即 Lambert Conformal Conic btw)。您可能需要进行更多调查才能确定需要什么。

CRS("+init=epsg:4202")
CRS arguments:
+init=epsg:4202 +proj=longlat +ellps=aust_SA +no_defs 

CRS("+init=epsg:3033")

CRS arguments:
+init=epsg:3033 +proj=lcc +lat_1=-68.5 +lat_2=-74.5 +lat_0=-50
+lon_0=70 +x_0=6000000 +y_0=6000000 +ellps=WGS84 +datum=WGS84 +units=m
+no_defs +towgs84=0,0,0 

您最初的 project() 错误地尝试从 WGS84 上的 longlat 转换为 AGD66 上的 longlat,但该功能无法做到这一点,因此它只是在混合中增加了混乱。基准不是投影,它是投影定义的关键部分,从这个意义上说,“AGD66 上的 longlat”是投影,就像“WGS84 上的兰伯特保角圆锥”一样。

于 2012-04-02T11:29:18.153 回答