Пример #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);
        }
Пример #2
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);
        }