Beispiel #1
0
        /// <summary>
        /// 从数据库中指定的投影字段得到坐标系统. 任何投影格式都能被使用.
        /// </summary>
        public CoordinateSystem GetCoordinateSystem(string str, ProjectionSearchType searchType)
        {
            CoordinateSystem cs = null;

            MapWinGIS.GeoProjection proj = new MapWinGIS.GeoProjection();
            if (proj.ImportFromAutoDetect(str))
            {
                cs = this.GetCoordinateSystem(proj, searchType);//返回proj相关的坐标系统
            }
            return(cs);
        }
Beispiel #2
0
        /// <summary>
        /// Gets coordinate system from database for specified projection string. Any projection format can be used.
        /// </summary>
        public ICoordinateSystem GetCoordinateSystem(string str, ProjectionSearchType searchType)
        {
            ICoordinateSystem cs = null;
            var proj             = new SpatialReference();

            if (proj.ImportFromAutoDetect(str))
            {
                cs = GetCoordinateSystem(proj, searchType);
            }

            if (cs == null && proj.ImportFromEsri(str))
            {
                cs = GetCoordinateSystem(proj, searchType);
            }

            return(cs);
        }
Beispiel #3
0
        /// <summary>
        /// Returns coordinate system object associated with given GeoProjection.
        /// This property is computationally expensive.
        /// </summary>
        public ICoordinateSystem GetCoordinateSystem(ISpatialReference projection, ProjectionSearchType searchType)
        {
            if (string.IsNullOrWhiteSpace(_dbname))
            {
                return(null);
            }

            if (projection == null || projection.IsEmpty)
            {
                return(null);
            }

            // standard
            var cs = GetCoordinateSystemCore(projection);

            if (searchType == ProjectionSearchType.Standard || cs != null)
            {
                return(cs);
            }

            // enhanced
            var projTest = new SpatialReference();

            if (projTest.ImportFromProj4(projection.ExportToProj4()))
            {
                cs = GetCoordinateSystemCore(projection);
            }

            if (searchType == ProjectionSearchType.Enhanced || cs != null)
            {
                return(cs);
            }

            // dialects
            RefreshDialects();
            int code = EpsgCodeByDialectString(projection);

            if (code != -1)
            {
                return(GetCoordinateSystem(code));
            }

            return(null);
        }
Beispiel #4
0
        /// <summary>
        /// 返回与给定的GeoProjection相关的坐标系统对象.
        /// 这个属性的计算量很大.
        /// </summary>
        public CoordinateSystem GetCoordinateSystem(MapWinGIS.GeoProjection projection, ProjectionSearchType searchType)
        {
            if (m_dbname == "")
            {
                return(null);
            }

            // standard
            CoordinateSystem cs = this.GetCoordinateSystemCore(projection);

            if (searchType == ProjectionSearchType.Standard || cs != null)
            {
                return(cs);
            }

            // enhanced
            MapWinGIS.GeoProjection projTest = new MapWinGIS.GeoProjection();
            if (projTest.ImportFromProj4(projection.ExportToProj4()))
            {
                cs = this.GetCoordinateSystemCore(projection);
            }
            if (searchType == ProjectionSearchType.Enhanced || cs != null)
            {
                return(cs);
            }

            // dialects
            this.RefreshDialects();
            int code = this.EpsgCodeByDialectString(projection);

            if (code != -1)
            {
                return(this.GetCoordinateSystem(code));
            }
            return(null);
        }