ArcEngine 坐标系转换

/// <summary>
/// 地理坐标系 转 投影坐标系
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="GCSType">地理坐标系编号</param>
/// <param name="PRJType">投影坐标系编号</param>
/// <returns></returns>
private IPoint GCStoPRJ(double x, double y, int GCSType, int PRJType)
{
    IPoint pPoint = new PointClass();
    pPoint.PutCoords(x, y);
    ISpatialReferenceFactory pSRF = new SpatialReferenceEnvironmentClass();
    pPoint.SpatialReference = pSRF.CreateGeographicCoordinateSystem(GCSType);
    //GCS_WGS_1984 WKID: 4326 权限: EPSG
    pPoint.Project(pSRF.CreateProjectedCoordinateSystem(PRJType));
    //Xian_1980_3_Degree_GK_CM_114E  WKID: 2383 权限: EPSG
    return pPoint;
}

/// <summary>
/// 投影坐标系 转 地理坐标系
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="GCSType">地理坐标系编号</param>
/// <param name="PRJType">投影坐标系编号</param>
/// <returns></returns>
private IPoint PRJtoGCS(double x, double y,int GCSType, int PRJType)
{
    IPoint pPoint = new PointClass();
    pPoint.PutCoords(x, y);
    ISpatialReferenceFactory pSRF = new SpatialReferenceEnvironmentClass();
    pPoint.SpatialReference = pSRF.CreateProjectedCoordinateSystem(PRJType);
    pPoint.Project(pSRF.CreateGeographicCoordinateSystem(GCSType));            
    return pPoint;
}

 

posted @ 2017-09-08 10:58  天秤水  阅读(813)  评论(0编辑  收藏  举报