gdal 坐标转换
经纬度转投影坐标系
只需要查找转换前后代号即可
可以http://epsg.io/?q=cgcs2000去搜索
UTM代号可在http://www.jaworski.ca/utmzones.htm查看
实例
WGS 84 / UTM zone 17N 转 WGS 84经纬度
// 设置投影变化
OGRCoordinateTransformation *poTransform;
{
OGRSpatialReference *RefSource = new OGRSpatialReference;
RefSource->importFromEPSG(32617);
OGRSpatialReference *RefTarget = new OGRSpatialReference;
RefTarget->importFromEPSG(4326);
auto oPGS = *RefSource;
std::cout << "SemiMajor->" << oPGS.GetSemiMajor() << std::endl;
std::cout << "SemiMinor->" << oPGS.GetSemiMinor() << std::endl;
std::cout << "InvFlattening->" << oPGS.GetInvFlattening() << std::endl;
poTransform = OGRCreateCoordinateTransformation(RefSource, RefTarget);
//double tempX = 430400.327;
//double tempY = 3359421.846;
//poTransform->Transform(1, &tempX, &tempY);
//std::cout << tempX << " " << tempY << std::endl;
}