【转】Arcengine经纬度转米

投影转经纬度
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);
}

  

转载于:https://www.cnblogs.com/tttttye-cnblogs/p/9322626.html

你可能感兴趣的:(【转】Arcengine经纬度转米)