/// <summary> /// Reprojects image /// </summary> public static TestingResult Reproject(MapWinGIS.Image image, out MapWinGIS.Image imageNew, MapWinGIS.GeoProjection projection, frmTesterReport report) { MapWinGIS.GeoProjection projImage = new MapWinGIS.GeoProjection(); projImage.ImportFromProj4(image.GetProjection()); string sourcePrj = image.GetProjection(); string targetPrj = projection.ExportToProj4(); string origFilename = image.Filename; MapWinGIS.ICallback callback = image.GlobalCallback; imageNew = null; LayerSource obj = new LayerSource(image); LayerSource objNew = null; if (CoordinateTransformation.SeekSubstituteFile(obj, projection, out objNew)) { imageNew = objNew.Image; return(TestingResult.Substituted); } string newFilename = CoordinateTransformation.FilenameWithProjectionSuffix(origFilename, projImage, projection); newFilename = CoordinateTransformation.GetSafeNewName(newFilename); // setting callback if (report != null) { if (!report.Visible) { report.InitProgress(projection); } report.ShowFilename(image.Filename); } MapWinGIS.GeoProcess.SpatialReference.ProjectImage(sourcePrj, targetPrj, origFilename, newFilename, report); if (report != null) { report.ClearFilename(); } imageNew = new MapWinGIS.Image(); if (imageNew.Open(newFilename, MapWinGIS.ImageType.USE_FILE_EXTENSION, false, callback)) { return(TestingResult.Ok); } else { imageNew = null; return(TestingResult.Error); } }