Beispiel #1
0
        static public ISpatialReference AXL2SpatialReference(XmlNode coordSysNode)
        {
            ISpatialReference sRef = null;

            if (coordSysNode != null)
            {
                try
                {
                    if (coordSysNode.Attributes["id"] != null && coordSysNode.Attributes["id"].Value != "0")
                    {
                        sRef = gView.Framework.Geometry.SpatialReference.FromID("epsg:" + coordSysNode.Attributes["id"].Value);
                    }
                    else if (coordSysNode.Attributes["string"] != null)
                    {
                        sRef = gView.Framework.Geometry.SpatialReference.FromWKT(coordSysNode.Attributes["string"].Value);
                    }

                    if (sRef != null && coordSysNode.Attributes["datumtransformid"] != null)
                    {
                        GeodeticDatum datum = Const.FromID(coordSysNode.Attributes["datumtransformid"].Value);
                        if (datum != null)
                        {
                            sRef.Datum = datum;
                        }
                    }
                    else if (sRef != null && coordSysNode.Attributes["datumid"] != null)
                    {
                        GeodeticDatum datum = Const.FromID(coordSysNode.Attributes["datumid"].Value);
                        if (datum != null)
                        {
                            sRef.Datum = datum;
                        }
                    }
                    else if (sRef != null && coordSysNode.Attributes["datumtransformstring"] != null)
                    {
                        GeodeticDatum datum = GeodeticDatum.FromESRIWKT(coordSysNode.Attributes["datumtransformstring"].Value);
                        if (datum != null)
                        {
                            sRef.Datum = datum;
                        }
                    }
                    else if (sRef != null && coordSysNode.Attributes["datumstring"] != null)
                    {
                        GeodeticDatum datum = GeodeticDatum.FromESRIWKT(coordSysNode.Attributes["datumstring"].Value);
                        if (datum != null)
                        {
                            sRef.Datum = datum;
                        }
                    }
                }
                catch { }
            }
            return(sRef);
        }