Azavea.NijPredictivePolicing.ACSAlchemistLibrary.FileFormats.ShapefileHelper.MakeOutputProjFile C# (CSharp) Метод

MakeOutputProjFile() публичный статический Метод

Copies an existing .prj file next to an existing shapefile (with correct destination name)
public static MakeOutputProjFile ( string sourceProjectionFilename, string destShapefilename ) : bool
sourceProjectionFilename string
destShapefilename string
Результат bool
        public static bool MakeOutputProjFile(string sourceProjectionFilename, string destShapefilename)
        {
            try
            {
                string prjFileName = Path.Combine(
                    Path.GetDirectoryName(destShapefilename),
                    Path.GetFileNameWithoutExtension(destShapefilename)) + ".prj";

                if (File.Exists(prjFileName))
                {
                    _log.DebugFormat("The file already exists: {0}", prjFileName);
                }

                if (File.Exists(sourceProjectionFilename))
                {
                    File.Copy(sourceProjectionFilename, prjFileName, true);
                }
                else
                {
                    var wkt = Utilities.GetCoordinateSystemWKTByID(sourceProjectionFilename);
                    if (!string.IsNullOrEmpty(wkt))
                    {
                        File.WriteAllText(prjFileName, wkt);
                    }
                }

            }
            catch (Exception ex)
            {
                _log.Error("There was an error trying to write a .prj file for your export.", ex);
            }
            return true;
        }