Exemplo n.º 1
0
        internal static ISpatialReference FromID_(string id)
        {
            ProjDB db         = new ProjDB();
            string parameters = db.GetParameters(id);
            string descr      = db.GetDescription(id);

            SpatialReference ret = new SpatialReference(id, descr, parameters, null);

            string pgWKT = db.GetPgWkt(id);

            if (!String.IsNullOrEmpty(pgWKT))
            {
                string axisX = db.GetQoutedWKTParameter(pgWKT, "AXIS[\"X\"", ",", "]");
                string axisY = db.GetQoutedWKTParameter(pgWKT, "AXIS[\"Y\"", ",", "]");

                switch (axisX)
                {
                case "NORTH":
                    ret.Gml3AxisX = AxisDirection.North;
                    break;

                case "EAST":
                    ret.Gml3AxisX = AxisDirection.East;
                    break;

                case "SOUTH":
                    ret.Gml3AxisX = AxisDirection.South;
                    break;

                case "WEST":
                    ret.Gml3AxisX = AxisDirection.West;
                    break;
                }
                switch (axisY)
                {
                case "NORTH":
                    ret.Gml3AxisY = AxisDirection.North;
                    break;

                case "EAST":
                    ret.Gml3AxisY = AxisDirection.East;
                    break;

                case "SOUTH":
                    ret.Gml3AxisY = AxisDirection.South;
                    break;

                case "WEST":
                    ret.Gml3AxisY = AxisDirection.West;
                    break;
                }
            }
            return(ret);
        }
Exemplo n.º 2
0
        public SpatialReference(string name, IGeodeticDatum datum)
        {
            _ID = name;
            ProjDB db = new ProjDB();

            this.Parameters = db.GetParameters(_ID).Split(' ');
            _description    = db.GetDescription(_ID);
            db.Dispose();
            _datum = datum;

            _sParams.SetMembers(this.Parameters);
        }
Exemplo n.º 3
0
        public SpatialReference(string name)
        {
            _ID = name;
            ProjDB db = new ProjDB(ProjDBTables.projs);

            this.Parameters = db.GetParameters(_ID).Split(' ');
            _description    = db.GetDescription(_ID);
            if (this.Datum != null)
            {
                this.Datum.Name = db.GetDatumName(_ID);
            }
            db.Dispose();

            _sParams.SetMembers(this.Parameters);
        }
Exemplo n.º 4
0
        internal static ISpatialReference FromID_(string id)
        {
            ProjDB db         = new ProjDB();
            string parameters = db.GetParameters(id);
            string descr      = db.GetDescription(id);

            SpatialReference ret = new SpatialReference(id, descr, parameters, null);

            string pgWKT = db.GetPgWkt(id);

            if (!String.IsNullOrEmpty(pgWKT))
            {
                string axisX = db.GetQoutedWKTParameter(pgWKT, "AXIS[\"X\"", ",", "]");
                string axisY = db.GetQoutedWKTParameter(pgWKT, "AXIS[\"Y\"", ",", "]");

                if (String.IsNullOrWhiteSpace(axisX) && String.IsNullOrWhiteSpace(axisY))
                {
                    if (ret.Parameters.Contains("+proj=utm"))
                    {
                        ret.Gml3AxisX = AxisDirection.East;
                        ret.Gml3AxisY = AxisDirection.North;
                    }
                    else if (ret.SpatialParameters.IsGeographic)  // 4326 => X-Axis to north => tested with QGIS!!
                    {
                        ret.Gml3AxisX = AxisDirection.North;
                        ret.Gml3AxisY = AxisDirection.East;
                    }
                }
                else
                {
                    switch (axisX)
                    {
                    case "NORTH":
                        ret.Gml3AxisX = AxisDirection.North;
                        break;

                    case "EAST":
                        ret.Gml3AxisX = AxisDirection.East;
                        break;

                    case "SOUTH":
                        ret.Gml3AxisX = AxisDirection.South;
                        break;

                    case "WEST":
                        ret.Gml3AxisX = AxisDirection.West;
                        break;
                    }
                    switch (axisY)
                    {
                    case "NORTH":
                        ret.Gml3AxisY = AxisDirection.North;
                        break;

                    case "EAST":
                        ret.Gml3AxisY = AxisDirection.East;
                        break;

                    case "SOUTH":
                        ret.Gml3AxisY = AxisDirection.South;
                        break;

                    case "WEST":
                        ret.Gml3AxisY = AxisDirection.West;
                        break;
                    }
                }
            }
            return(ret);
        }