Ejemplo n.º 1
0
        /// <summary>
        /// Reads and parses the projection if a projection file exists
        /// </summary>
        private void ParseProjection()
        {
            string projfile = Path.GetDirectoryName(Filename) + "\\" + Path.GetFileNameWithoutExtension(Filename) + ".prj";

            if (System.IO.File.Exists(projfile))
            {
                try
                {
                    string wkt = System.IO.File.ReadAllText(projfile);
                    _CoordinateSystem     = (SharpMap.CoordinateSystems.ICoordinateSystem)SharpMap.Converters.WellKnownText.CoordinateSystemWktReader.Parse(wkt);
                    _CoordsysReadFromFile = true;
                }
                catch (System.Exception ex) {
                    System.Diagnostics.Trace.TraceWarning("Coordinate system file '" + projfile + "' found, but could not be parsed. WKT parser returned:" + ex.Message);
                    throw (ex);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Reads and parses the projection if a projection file exists
 /// </summary>
 private void ParseProjection()
 {
     string projfile = Path.GetDirectoryName(Filename) + "\\" + Path.GetFileNameWithoutExtension(Filename) + ".prj";
     if (System.IO.File.Exists(projfile))
     {
         try
         {
             string wkt = System.IO.File.ReadAllText(projfile);
             _CoordinateSystem = (SharpMap.CoordinateSystems.ICoordinateSystem)SharpMap.Converters.WellKnownText.CoordinateSystemWktReader.Parse(wkt);
             _CoordsysReadFromFile = true;
         }
         catch(System.Exception ex) {
             System.Diagnostics.Trace.TraceWarning("Coordinate system file '" + projfile + "' found, but could not be parsed. WKT parser returned:" + ex.Message);
             throw (ex);
         }
     }
 }