Geotools转换点失败

时间:2015-07-03 10:13:28

标签: geotools

我正在开发一个使用java的应用程序,它允许将EPSG转换为4326点:EPSG:2972。

我的代码有效:

//在两个坐标参照系之间进行转换

MathTransform mathTransform = CRS.findMathTransform(" EPSG:4326"," EPSG:2972",true);

//指向转换

DirectPosition2D srcDirectPosition2D = new DirectPosition2D();

srcDirectPosition2D.setCoordinateReferenceSystem(CoordSysINT);

srcDirectPosition2D.setLocation(4.4665424,-52.4648442);

DirectPosition2D destDirectPosition2D = new DirectPosition2D();

//转化

mathTransform.transform(srcDirectPosition2D,destDirectPosition2D);

//投影点

ProjectedPoint = new Point(destDirectPosition2D.getX(), destDirectPosition2D.getY(),NULL);

结果是:X:337473.6430296206 Y:493858.9919024287但是错了。
如果我将网站用作http://cs2cs.mygeodata.eu/并进行相同的转换,则真正的结果是337470.842698; 493860.962631

我的代码的结果对应于EPSG:4326和EPSG:32622之间的转换,但我不明白为什么?

我的代码有什么问题?

非常感谢

此致

尼古拉斯

1 个答案:

答案 0 :(得分:1)

EPSG的Proj.4文本:2972是

+ proj = utm + zone = 22 + ellps = GRS80 + towgs84 = 2,2,-2,0,0,0,0 + units = m + no_defs

在Geotool中,EPSG数据库v8.6显示了EPSG的WKT:2972

2972​​ = PROJCS [" RGFG95 / UTM区22N",GEOGCS [" RGFG95",DATUM [" Reseau Geodesique Francais Guyane 1995",SPHEROID [&## 34; GRS 1980",6378137.0,298.257222101,AUTHORITY [" EPSG"," 7019"]], TOWGS84 [0.0,0.0,0.0,0.0,0.0,0.0 ,0.0] ,AUTHORITY [" EPSG"," 6624"]],PRIMEM [" Greenwich",0.0,AUTHORITY [" EPSG& #34;," 8901"]],UNIT [" degree",0.017453292519943295],AXIS [" Geodetic longitude",EAST],AXIS ["大地纬度",NORTH],AUTHORITY [" EPSG"," 4624"]],PROJECTION [" Transverse_Mercator",AUTHORITY [" EPSG&# 34;," 9807"]],PARAMETER [" central_meridian",-51.0],PARAMETER [" latitude_of_origin",0.0],PARAMETER [" scale_factor& #34;,0.9996],PARAMETER [" false_easting",500000.0],PARAMETER [" false_northing",0.0],UNIT [" m",1.0],AXIS [" Easting",EAST],AXIS [" Northing",NORTH],AUTHORITY [" EPSG" " 2972​​"]]

注意突出显示的toWGS84转换是不同的。这可以解释你所看到的差异。我不知道哪个是正确的,但我觉得EPSG WKT是错误的。

这种差异改变了EPSG的行为:2972与EPSG的行为:32622。更技术性的答案是,EPSG:2972的基准面(GRS80)的球体表现得好像它是EPSG的基准面(WGS84)的椭球体:32622