C# ArcEngine获取坐标系、投影类型、计量单位、带号、几度分带、精度

C# ArcEngine获取坐标系、投影类型、计量单位、带号、几度分带、精度

                //获取参数
                IGeoDataset pDataset = TarFealyr.FeatureClass as IGeoDataset;
                ISpatialReference pSpatialReference = pDataset.SpatialReference;
                IGeographicCoordinateSystem pGeoCoordSys = (pSpatialReference as IProjectedCoordinateSystem).GeographicCoordinateSystem;//地理坐标
                IProjection pProjection = (pSpatialReference as IProjectedCoordinateSystem).Projection;//投影坐标系
                string sProjection = pProjection.Name;//投影坐标系
                double dCentral = (pSpatialReference as IProjectedCoordinateSystem).get_CentralMeridian(true);//中央经线
                double dFalseEast = (pSpatialReference as IProjectedCoordinateSystem).FalseEasting;
                IDatum pDatum = pGeoCoordSys.Datum;
                ISpheroid pSpheroid = pDatum.Spheroid;
                string sCoordinateSystem = pSpheroid.Name;//地理坐标
                dFalseEast = Math.Round(dFalseEast);
                int iDegree = int.Parse(((dFalseEast.ToString()).Substring(0, 3)));
                string sDegree = string.Empty;
                string sDegreeNo = string.Empty;
                double dPrecision = (pSpatialReference as ISpatialReferenceResolution).get_XYResolution(true);//数据精度
                ILinearUnit pLinearUnit = (pSpatialReference as IProjectedCoordinateSystem).CoordinateUnit;//计量单位
                string sUnit = pLinearUnit.Name;
                string sConverParam = string.Empty;
                string sVertion = string.Empty;
                string sCompany = string.Empty;
                string sParamConf = m_ZDDataSource.ParamConfigFile;

                if (iDegree > 250)
                {
                    sDegree = “3”;
                }
                else
                {
                    sDegree = “6”;
                }

                if (sDegree == “3”)
                {
                    sDegreeNo = (Math.Floor(dCentral / 3)).ToString();
                }
                else
                {
                    sDegreeNo = (Math.Floor((dCentral + 3) / 6)).ToString();
                }

                //地理坐标系转中文
                if (sCoordinateSystem.ToUpper() == “XIAN_1980”)
                {
                    sCoordinateSystem = “西安80”;
                }
                else if (sCoordinateSystem.ToUpper() == “BEIJING_1954”)
                {
                    sCoordinateSystem = “北京54”;
                }

                //投影坐标系转中文
                if (sProjection.ToUpper() == “GAUSS_KRUGER”)
                {
                    sProjection = “高斯克吕格”;
                }
                else if (sProjection.ToUpper() == “UTM”)
                {
                    sProjection = “通用横轴墨卡托”;
                }
                else if (sProjection.ToUpper() == “LAMBERT_CONFORMAL_CONIC”)
                {
                    sProjection = “等角割圆锥”;//兰勃特等角投影、等角正轴割圆锥投影
                }

                //单位转中文
                if (sUnit.ToUpper() == “KILOMETER”)
                {
                    sUnit = “千米”;
                }
                else if (sUnit.ToUpper() == “METER”)
                {
                    sUnit = “米”;
                }
                else if (sUnit.ToUpper() == “CENTIMETER”)
                {
                    sUnit = “厘米”;
                }
                else if (sUnit.ToUpper() == “MILLIMETER”)
                {
                    sUnit = “毫米”;
                }
                else if (sUnit.ToUpper() == “INCH”)
                {
                    sUnit = “英寸”;
                }
                else if (sUnit.ToUpper() == “MILE”)
                {
                    sUnit = “英里”;
                }

转载自:https://blog.csdn.net/mengxiangzhengfaya/article/details/52985746

You may also like...

退出移动版