示例#1
0
 public GeographicCoordSystem(WktItem wktItem)
 {
     _name              = wktItem.Value.Split(',')[0].Replace("\"", string.Empty);
     _angularUnit       = new AngularUnit(wktItem.GetWktItem("UNIT"));
     _primeMeridian     = new PrimeMeridian(wktItem.GetWktItem("PRIMEM"));
     _datum             = new Datum(wktItem.GetWktItem("DATUM"));
     _oracleSpatialSRID = int.MinValue;
 }
示例#2
0
        public ISpatialReference Parse(string wkt)
        {
            _rootWktItem = new WktSpliter().Split(wkt);
            bool isPrj = IsProjectionCoordSystem();
            bool isGeo = IsGeographicCoordSystem();

            if (!isPrj && !isGeo)
            {
                throw new Exception("本系统只支持地理坐标系统与投影坐标系统,坐标系统\"" + _rootWktItem.Name + "\"不受支持。");
            }
            IGeographicCoordSystem _geoCoordSystem = null;
            IProjectionCoordSystem _prjCoordSystem = null;

            _geoCoordSystem = ParseGeoCoordSystem(_rootWktItem.GetWktItem(cstGeoCoordSystem));
            _prjCoordSystem = ParseProjectionCoordSystem(_rootWktItem.GetWktItem(cstPrjCoordSystem));
            return(new SpatialReference(_geoCoordSystem, _prjCoordSystem));
        }
        /*
         * PROJECTION["Mercator"],
         * PARAMETER["False_Easting",0.0],
         * PARAMETER["False_Northing",0.0],
         * PARAMETER["Central_Meridian",0.0],
         * PARAMETER["Standard_Parallel_1",0.0],
         * UNIT["Meter",1.0]
         */
        protected override IProjectionCoordSystem ParseProjectionCoordSystem(WktItem wktItem)
        {
            if (wktItem == null)//Is Graphics Coordinate System
            {
                return(null);
            }
            string      name    = wktItem.Value.Split(',')[0].Replace("\"", string.Empty);
            NameMapItem prjName = GetPrjName(wktItem.GetWktItem("PROJECTION"));

            if (prjName == null)
            {
                throw new Exception("投影坐标系统\"" + name + "\"没有在系统中预先配置。");
            }
            NameValuePair[]       parameters = GetPrjParameters(wktItem.GetWktItems("PARAMETER"));
            AngularUnit           unit       = new AngularUnit(wktItem.GetWktItem("UNIT"));
            ProjectionCoordSystem prj        = new ProjectionCoordSystem(prjName, parameters, unit);

            prj.NameDes = name;
            return(prj);
        }
示例#4
0
 //DATUM["D_WGS_1984",
 //             SPHEROID["WGS_1984",6378137.0,298.257223563]
 //            ]
 public Datum(WktItem wktItem)
 {
     Spheroid = new Spheroid(wktItem.GetWktItem("SPHEROID"));
     Name     = (wktItem.Value.Split(',')[0]).Replace("\"", string.Empty);
 }