public static bool Create(string outputPath, string[] inputPaths, GDALBuildVRTOptions options, Gdal.GDALProgressFuncDelegate progressFuncDelegate) { bool result = false; Dataset newDs = null; try { Gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); //Gdal.PushErrorHandler(GdalConfig.GdalHandlers.ErrorHandler); newDs = Gdal.wrapper_GDALBuildVRT_names(outputPath, inputPaths, options, progressFuncDelegate, null); //Gdal.PopErrorHandler(); Gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); } catch (Exception ex) { LoggerManager.WriteErrorLog(ex.Message); } finally { if (newDs != null) { newDs.FlushCache(); newDs.Dispose(); result = true; } Gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); } return(result); }
public void TranslateAction(List <string> files) { GDALTranslateOptions transOptions = new GDALTranslateOptions(new[] { "-of", "KMLSUPEROVERLAY", "-co", "format=png" }); var vrtOptions = new GDALBuildVRTOptions(new[] { "-overwrite" }); var vrtFile = BuildVRT("tempVRT", files, vrtOptions); Gdal.wrapper_GDALTranslate(Path.Combine(OutputDirName, KMZFileName), vrtFile, transOptions, null, null); }
private bool SetVrtCreateInfo() { _vrtCreateInfo = new VrtCreateInfo(); PathInfo pathInfo = _vrtCreatePathSettingControl.GetVrtCreatePathInfo(); if (pathInfo.InputPathList.Count < 1) { MessageBox.Show("변환 경로 정보를 확인해주세요.", "변환", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } if (pathInfo.OutputPathString.Length < 1) { MessageBox.Show("변환 경로 정보를 확인해주세요.", "변환", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } _vrtCreateInfo.VrtCreatePathInfo = pathInfo; List <string> options = _vrtCreateOptionControl.GetVrtCreateOptions(); GDALBuildVRTOptions buildVrtOptions = CreateGdalBuildVrtOptions(options.ToArray()); if (buildVrtOptions == null) { return(false); } _vrtCreateInfo.CreateOptions = options; _vrtCreateInfo.BuildVrtOptions = buildVrtOptions; string outputDirectory = Path.GetDirectoryName(pathInfo.OutputPathString); DirectoryInfo di = new DirectoryInfo(outputDirectory); if (!di.Exists) { di.Create(); //Directory.CreateDirectory(outputDirectory); } LoggerManager.WriteVrtCreateInfoLog(_vrtCreateInfo); return(true); }
private GDALBuildVRTOptions CreateGdalBuildVrtOptions(string[] options) { GDALBuildVRTOptions buildVrtOptions = null; try { buildVrtOptions = new GDALBuildVRTOptions(options); } catch (Exception ex) { string errorMsg = "VRT 생성 옵션 정보를 확인해주세요."; errorMsg += Environment.NewLine; errorMsg += ex.Message; MessageBox.Show(errorMsg, "VRT 생성 옵션 설정", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(buildVrtOptions); }
private Dataset BuildVRT(string vrtFile, List <string> tiffFiles, GDALBuildVRTOptions vrtOptions) { return(Gdal.wrapper_GDALBuildVRT_names(vrtFile, tiffFiles.ToArray(), vrtOptions, null, null)); }