private static CoordinateSystem ReadCoordinateSystem(string coordinateSystem, WktStreamTokenizer tokenizer, bool includeAuthority)
        {
            CoordinateSystem returnCS = null;

            switch (coordinateSystem)
            {
            case "VERT_CS":
                VerticalCoordinateSystem verticalCS = ReadVerticalCoordinateSystem(tokenizer, includeAuthority);
                returnCS = verticalCS;
                break;

            case "GEOGCS":
                GeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer, includeAuthority);
                returnCS = geographicCS;
                break;

            case "PROJCS":
                ProjectedCoordinateSystem projectedCS = ReadProjectedCoordinateSystem(tokenizer, includeAuthority);
                returnCS = projectedCS;
                break;

            case "COMPD_CS":
                CompoundCoordinateSystem compoundCS = ReadCompoundCoordinateSystem(tokenizer, includeAuthority);
                returnCS = compoundCS;
                break;

            case "GEOCCS":
            case "FITTED_CS":
            case "LOCAL_CS":
                throw new InvalidOperationException(String.Format("{0} coordinate system is not recongized.", coordinateSystem));
            }
            return(returnCS);
        }
        private static VerticalCoordinateSystem ReadVerticalCoordinateSystem(WktStreamTokenizer tokenizer, bool includeAuthority)
        {
            //VERT_CS["Newlyn",
            //VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]]
            //UNIT["metre",1,AUTHORITY["EPSG","9001"]]
            //AUTHORITY["EPSG","5701"]

            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.ReadToken("VERT_DATUM");
            VerticalDatum verticalDatum = ReadVerticalDatum(tokenizer, includeAuthority);

            tokenizer.ReadToken("UNIT");
            Unit   unit          = ReadUnit(tokenizer, includeAuthority);
            string authority     = String.Empty;
            string authorityCode = String.Empty;

            if (includeAuthority)
            {
                tokenizer.ReadAuthority(ref authority, ref authorityCode);
            }
            tokenizer.ReadToken("]");

            VerticalCoordinateSystem verticalCS = new VerticalCoordinateSystem(name, verticalDatum, String.Empty, authority, authorityCode, String.Empty, String.Empty);

            return(verticalCS);
        }
 private static void WriteVerticalCoordinateSystem(VerticalCoordinateSystem verticalCoordinateSystem, bool esri, IndentedTextWriter writer)
 {
     writer.WriteLine("VERT_CS[");
     writer.Indent = writer.Indent + 1;
     writer.WriteLine(String.Format("\"{0}\",", verticalCoordinateSystem.Name));
     WriteDatum(verticalCoordinateSystem.VerticalDatum, esri, writer);
     WriteUnit(verticalCoordinateSystem.VerticalUnit, esri, writer);
     //writer.WriteLine(String.Format("AUTHORITY[\"{0}\",\"{1}\"]", verticalCoordinateSystem.Authority, verticalCoordinateSystem.AuthorityCode));
     WriteAuthority(verticalCoordinateSystem, esri, writer);
     writer.Indent = writer.Indent - 1;
     writer.WriteLine("]");
 }
        public static object Create(string wkt)
        {
            object             returnObject     = null;
            bool               includeAuthority = (wkt.ToLower().IndexOf("authority") != -1);
            StringReader       reader           = new StringReader(wkt);
            WktStreamTokenizer tokenizer        = new WktStreamTokenizer(reader);

            tokenizer.NextToken();
            string objectName = tokenizer.GetStringValue();

            switch (objectName)
            {
            case "UNIT":
                Unit unit = ReadUnit(tokenizer, includeAuthority);
                returnObject = unit;
                break;

            case "VERT_DATUM":
                VerticalDatum verticalDatum = ReadVerticalDatum(tokenizer, includeAuthority);
                returnObject = verticalDatum;
                break;

            case "SPHEROID":
                Ellipsoid ellipsoid = ReadEllipsoid(tokenizer, includeAuthority);
                returnObject = ellipsoid;
                break;

            case "TOWGS84":
                WGS84ConversionInfo wgsInfo = ReadWGS84ConversionInfo(tokenizer, includeAuthority);
                returnObject = wgsInfo;
                break;

            case "DATUM":
                HorizontalDatum horizontalDatum = ReadHorizontalDatum(tokenizer, includeAuthority);
                returnObject = horizontalDatum;
                break;

            case "PRIMEM":
                PrimeMeridian primeMeridian = ReadPrimeMeridian(tokenizer, includeAuthority);
                returnObject = primeMeridian;
                break;

            case "VERT_CS":
                VerticalCoordinateSystem verticalCS = ReadVerticalCoordinateSystem(tokenizer, includeAuthority);
                returnObject = verticalCS;
                break;

            case "GEOGCS":
                GeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer, includeAuthority);
                returnObject = geographicCS;
                break;

            case "PROJCS":
                ProjectedCoordinateSystem projectedCS = ReadProjectedCoordinateSystem(tokenizer, includeAuthority);
                returnObject = projectedCS;
                break;

            case "COMPD_CS":
                CompoundCoordinateSystem compoundCS = ReadCompoundCoordinateSystem(tokenizer, includeAuthority);
                returnObject = compoundCS;
                break;

            case "GEOCCS":
            case "FITTED_CS":
            case "LOCAL_CS":
                throw new NotSupportedException(String.Format("{0} is not implemented.", objectName));

            default:
                throw new ParseException(String.Format("'{0'} is not recongnized.", objectName));
            }
            reader.Close();
            return(returnObject);
        }