Example #1
0
        /// <summary>
        /// Parses the entire projection from an Esri string.  In some cases, this will have
        ///   default projection information since only geographic information is obtained.
        /// </summary>
        /// <param name="esriString">
        /// The Esri string to parse
        /// </param>
        public static ProjectionInfo FromEsriString(string esriString)
        {
            if (String.IsNullOrWhiteSpace(esriString))
            {
                // Return a default 'empty' projection
                return(new ProjectionInfo());
            }

            //special case for Krovak Projection
            //todo use a lookup table instead of hard coding the projection here
            if (esriString.Contains("Krovak"))
            {
                return(KnownCoordinateSystems.Projected.NationalGrids.SJTSKKrovakEastNorth);
            }

            var info = new ProjectionInfo();

            info.NoDefs = true;
            if (!info.TryParseEsriString(esriString))
            {
                throw new InvalidEsriFormatException(esriString);
            }

            return(info);
        }
        /// <summary>
        /// Parses the entire projection from an Esri string.  In some cases, this will have
        ///   default projection information since only geographic information is obtained.
        /// </summary>
        /// <param name="esriString">
        /// The Esri string to parse
        /// </param>
        public static ProjectionInfo FromEsriString(string esriString)
        {
            if (String.IsNullOrWhiteSpace(esriString))
            {
                // Return a default 'empty' projection
                return(new ProjectionInfo());
            }

            if (esriString.Contains("Krovak"))
            {
                return(ProjectionInfo.FromProj4String("+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813975277778 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +units=m +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56 +no_defs "));
            }

            var info = new ProjectionInfo();

            info.NoDefs = true;
            if (!info.TryParseEsriString(esriString))
            {
                throw new InvalidEsriFormatException(esriString);
            }

            return(info);
        }
Example #3
0
        /// <summary>
        /// Parses the entire projection from an Esri string.  In some cases, this will have
        ///   default projection information since only geographic information is obtained.
        /// </summary>
        /// <param name="esriString">
        /// The Esri string to parse
        /// </param>
        public static ProjectionInfo FromEsriString(string esriString)
        {
            if (String.IsNullOrWhiteSpace(esriString))
            {
                // Return a default 'empty' projection
                return new ProjectionInfo();
            }

            //special case for Krovak Projection
            //todo use a lookup table instead of hard coding the projection here
            if (esriString.Contains("Krovak"))
                return KnownCoordinateSystems.Projected.NationalGrids.SJTSKKrovakEastNorth;

            var info = new ProjectionInfo();
            info.NoDefs = true;
            if (!info.TryParseEsriString(esriString))
            {
                throw new InvalidEsriFormatException(esriString);
            }

            return info;
        }