【发布时间】:2015-02-09 16:03:48
【问题描述】:
我正在尝试将WGS84 系统中的lat/lon 坐标重新投影到SIRGAS 2000 坐标系统中的UTM。
使用GDAL,我首先将已知的 utm 坐标更改为 在同一坐标系 (29 N) 中对应的纬度/经度坐标,只是为了检查我是否编写了正确的代码(我'我在这里省略了错误检查):
OGRSpatialReference monUtm;
monUtm.SetWellKnownGeogCS("WGS84");
monUtm.SetUTM(29, true);
OGRSpatialReference monGeo;
monGeo.SetWellKnownGeogCS("WGS84");
OGRCoordinateTransformation* coordTrans = OGRCreateCoordinateTransformation(&monUtm, &monGeo);
double x = 621921.3413490148;
double y = 4794536.070196861;
int reprojected = coordTrans->Transform(1, &x, &y);
// If OK, print the coords.
delete coordTrans;
coordTrans = OGRCreateCoordinateTransformation(&monGeo, &monUtm);
reprojected = coordTrans->Transform(1, &x, &y);
// If OK, Print the coords.
delete coordTrans;
坐标621921.3413490148, 4794536.070196861correspond to the Moncelos region in northern Galicia。来回转换似乎工作正常:纬度/经度坐标是正确的,当投影回 UTM 时,我得到 与原件相同的:
UTM: 621921.34135 , 4794536.0702
Lat/lon: 43.293779579 , -7.4970160261
Back to UTM: 621921.34135 , 4794536.0702
现在,从 WGS84 lat/long 重新投影到 SIRGAS 2000 UTM:
// Rodovia dos Tamoios, Brazil:
// - UTM -> 23 S
// - WGS 84 -> EPSG:32723
// - SIRGAS 2000 -> EPSG:31983
OGRSpatialReference wgs;
wgs.SetWellKnownGeogCS("WGS84");
OGRSpatialReference sirgas;
sirgas.importFromEPSG(31983);
coordTrans = OGRCreateCoordinateTransformation(&wgs, &sirgas);
double x = -23.57014667;
double y = -45.49159617;
reprojected = coordTrans->Transform(1, &x, &y);
// If OK, print results
delete coordTrans;
coordTrans = OGRCreateCoordinateTransformation(&sirgas, &wgs);
reprojected = coordTrans->Transform(1, &x, &y);
// If OK, print results.
这不会给出相同的结果:
WGS84 Lat/Lon input: -23.57014667 , -45.49159617
SIRGAS 2000 UTM output: 2173024.0216 , 4734004.2131
Back to WGS84 Lat/Lon: -23.570633824 , -45.491627598
如您所见,与第一个测试用例不同,原始的 WGS84 lat/lon 和 back-to_WGS84 lat/lon 坐标并不完全相同。此外,UTM x-coord 有 7 位数字(我认为它仅限于 6 (?) )。
In Google Maps,我们可以看到两点之间相差27米(原点用圆表示。我的“反投影”点用表示>匕首)。
最后,问题是:我做的重投影对吗?如果是这样,为什么第二个测试用例的重投影之间有 27 米的差异?
【问题讨论】:
标签: c++ gdal coordinate-systems mingw-w64