public Task <double[]> GetGdalExtentAsync(string source) { var process = new AsyncProcess <double[]>(@"%GDAL%\gdalinfo", parseRasterExtent) { EnvironmentVariables = EnvironmentVariables, WorkingFolder = WorkingFolder }; return(process.RunAsync(string.Format(@"""{0}""", source))); }
public Task <GdalInfoResult> GetGDALInfoAsync(string source) { var process = new AsyncProcess <GdalInfoResult>(@"%GDAL%\gdalinfo", parseGDALInfo) { EnvironmentVariables = EnvironmentVariables, WorkingFolder = WorkingFolder }; return(process.RunAsync(string.Format(@"""{0}""", source))); }
public Task <double[]> GetOgrExtentAsync(string source, string layer = null) { var process = new AsyncProcess <double[]>(@"%GDAL%\ogrInfo", parseExtent) { EnvironmentVariables = EnvironmentVariables, WorkingFolder = WorkingFolder }; return(process.RunAsync(string.Format(@"-so -al ""{0}"" {1}", source, layer))); }
public Task <int> AddSpatialIndexToMSQL(string connectionstring, string tablename) { var process = new AsyncProcess(@"%GDAL%\ogrinfo") { EnvironmentVariables = EnvironmentVariables, WorkingFolder = WorkingFolder }; return(process.RunAsync(string.Format(@" ""{1}"" -sql ""create spatial index on {0}""", tablename, connectionstring))); }
public Task <int> BuildVrtFileAsync(string filelist, string outputfile) { var process = new AsyncProcess(@"%GDAL%\gdalbuildvrt") { EnvironmentVariables = EnvironmentVariables, WorkingFolder = WorkingFolder }; return(process.RunAsync(string.Format(@" -input_file_list ""{0}"" ""{1}""", filelist, outputfile))); }
public Task <string> GetProj4TextAsync(string source, string layer = null) { var path = Path.ChangeExtension(source, "prj"); var process = new AsyncProcess <string>(@"%GDAL%\gdalsrsinfo", parseProj4) { EnvironmentVariables = EnvironmentVariables, WorkingFolder = WorkingFolder }; return(process.RunAsync(string.Format(@"""{0}""", path))); }
public Task <int> Ogr2OgrClipAsync(string source, string target, string t_srs, double[] extent) { var process = new AsyncProcess(@"%GDAL%\ogr2ogr") { EnvironmentVariables = EnvironmentVariables, WorkingFolder = WorkingFolder }; return(process.RunAsync(string.Format(@"{0} {1} -t_srs {2} -spat {3}", target, source, t_srs, string.Join(" ", extent)))); }
public Task <int> GdalExtractWithTranslate(string source, string target, string projwin, string outtype, int?outputsize = null, params string[] createOptions) { var process = new AsyncProcess(@"%GDAL%\gdal_translate") { EnvironmentVariables = EnvironmentVariables, WorkingFolder = WorkingFolder }; return(process.RunAsync(string.Format(@" -of {2} {5} {4} -projwin {1} ""{0}"" ""{3}"" ", source, projwin, outtype, target, outputsize.HasValue ? string.Format("-outsize {0} {0}", outputsize.Value):"", string.Join(" ", createOptions.Select(co => string.Format("-co {0}", co))) ))); //(outtype=="gtiff") ? "-co COMPRESS=LZW -co PREDICTOR=2" : (outtype=="png"?"-co WORLDFILE=YES":"") }