Más pruebas

master
Elena 2021-02-23 21:44:11 +01:00
parent 74c525a901
commit 1abf90fe19
1 changed files with 14 additions and 9 deletions

View File

@ -40,14 +40,17 @@ namespace PruebaAddIn
string layerpath, outpath;
layerpath = "D:\\Proyectos\\Olivia\\Datos\\gdbs\\Soria.gdb\\prueba";
outpath = "D:\\Proyectos\\Olivia\\Pruebas";
//layerpath = @"Z:\Europe.gdb\Streets";
//layerpath = @"C:\Users\narvaling_epareja\Documents\ArcGIS\Projects\MyProject\MyProject.gdb\SanLorenzo";
//outpath = @"C:\Users\narvaling_epareja\Documents\PruebasOlivia";
ConvertShp(layerpath, outpath);
}
protected async Task<string> ConvertShp(string layerpath, string outpath)
{
/*if (!System.IO.Directory.Exists(outpath))
if (!System.IO.Directory.Exists(outpath))
System.IO.Directory.CreateDirectory(outpath);
var valueArray = await QueuedTask.Run(() =>
/*var valueArray = await QueuedTask.Run(() =>
{
//input layers list should contain the path of each layer name, i.e. if the root node is "Mapping" and the layer name is "gs_points", path is "Mapping\\gs_points".
List<string> inlayers = new List<string>();
@ -59,14 +62,14 @@ namespace PruebaAddIn
using (Geodatabase fileGeodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri("D:\\Proyectos\\Olivia\\Datos\\gdbs\\Soria.gdb"))))
using (FeatureClass featureClass = fileGeodatabase.OpenDataset<FeatureClass>("prueba"))
{
FeatureClassDefinition facilitySiteDefinition = featureClass.GetDefinition();
int facilityIdIndex = facilitySiteDefinition.FindField("TIPO_ENT");
//FeatureClassDefinition facilitySiteDefinition = featureClass.GetDefinition();
//int facilityIdIndex = facilitySiteDefinition.FindField("TIPO_ENT");
string whereClause = "NOM_TIPO_ENTIDAD = 'Aceras'";
Selection sel = featureClass.Select(new QueryFilter { WhereClause = whereClause }, SelectionType.ObjectID, SelectionOption.Normal);
}
var progDlg = new ProgressDialog("Running Geoprocessing Tool", "Cancel", 100, true);
var progDlg = new ProgressDialog("Running Geoprocessing Tool", "Cancel", 100, true);
progDlg.Show();
var progSrc = new CancelableProgressorSource(progDlg);
@ -84,7 +87,7 @@ namespace PruebaAddIn
null, new CancelableProgressorSource(progDlg).Progressor, GPExecuteToolFlags.Default);
// dialog hides itself once the execution is complete
progDlg.Hide();
//progDlg.Hide();
/*//input layers list should contain the path of each layer name, i.e. if the root node is "Mapping" and the layer name is "gs_points", path is "Mapping\\gs_points".
@ -98,10 +101,12 @@ namespace PruebaAddIn
//
GPExecuteToolFlags flags = GPExecuteToolFlags.GPThread; // instruct the tool run non-blocking GPThread
IGPResult gpResult = await Geoprocessing.ExecuteToolAsync("FeatureClassToShapefile_conversion", valueArray, null, null, null, flags);*/
return string.IsNullOrEmpty(gpResult.ReturnValue)
string res = string.IsNullOrEmpty(gpResult.ReturnValue)
? $@"Error in gp tool: {gpResult.ErrorMessages}"
: $@"Ok: {gpResult.ReturnValue}";
return res;
}
}
}