码迷,mamicode.com
首页 > 其他好文 > 详细

【转】Arcengine经纬度转米

时间:2018-07-17 12:43:12      阅读:273      评论:0      收藏:0      [点我收藏+]

标签:psr   factor   ati   new   top   phi   ocs   经纬   domain   

投影转经纬度
private IPoint PRJtoGCS( double x, double y)
{
    IPoint pPoint = new PointClass();
    pPoint.PutCoords(x, y);
    ISpatialReferenceFactory pSRF = new SpatialReferenceEnvironmentClass();
    pPoint.SpatialReference = pSRF.CreateProjectedCoordinateSystem( 2414 );
pPoint.Project(pSRF.CreateGeographicCoordinateSystem(( int)esriSRGeoCSType.esriSRGeoCS_Beijing1954));
    return pPoint;
}

 
其中,pPoint.SpatialReference = pSRF.CreateProjectedCoordinateSystem( 2414 );
这行代码是设置pPoint 的空间参考,也就是要转化的点的投影坐标。如果不知道投影坐标的话,转化会报异常。
2414 为该投影的enum 值
pPoint.Project(pSRF.CreateGeographicCoordinateSystem(( int)esriSRGeoCSType.esriSRGeoCS_Beijing1954));
将该点的投影坐标转化为经纬度。
 
经纬度到投影:
private IPoint GCStoPRJ(IPoint pPoint)
{
            ISpatialReferenceFactory pSpatialReferenceFactory = new SpatialReferenceEnvironment();
            pPoint.SpatialReference = pSpatialReferenceFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_Krasovsky1940);
            IProjectedCoordinateSystem pProjectCoodinateSys = pSpatialReferenceFactory.CreateProjectedCoordinateSystem((int)esriSRProjCS4Type.esriSRProjCS_Xian1980_GK_Zone_17);
            ISpatialReference pSpatialReference = (ISpatialReference)pProjectCoodinateSys;
            pSpatialReference.SetDomain(17352988.066800, 18230892.557100, 2326007.173500, 3237311.062300);
            pPoint.Project(pSpatialReference);
}

  

【转】Arcengine经纬度转米

标签:psr   factor   ati   new   top   phi   ocs   经纬   domain   

原文地址:https://www.cnblogs.com/tttttye-cnblogs/p/9322626.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!