Hi
I want to create a fishnet using the csharp code,Why isn't it generated after the code runs?thank you.
rs
await QueuedTask.Run(async () =>
{
string out_feature_class = @"F:\data\fishnet.shp";
double cellSizeWidth = 0;
double cellSizeHeight = 0;
long numRows = 10;
long numCols = 10;
string labels = "NO_LABELS";
string template = "DISPLAY";
string geometryType = "POLYGON";
var parameters = Geoprocessing.MakeValueArray(out_feature_class, null, null, cellSizeWidth, cellSizeHeight, numRows, numCols, "",labels, template, geometryType);
await Geoprocessing.ExecuteToolAsync("management.CreateFishnet", parameters);
}
});
Solved! Go to Solution.
The problem is solved, two parameters are added(origin_coord,y_axis_coord), and two parameters are modified(cell_width,cell_height).And delete this code:LayerFactory.Instance.CreateLayer(new Uri(out_feature_class), mapView.Map)
Does the shapefile get created on your drive but isn't added to the map? If so, set the GPExecuteToolFlags enumeration to AddOutputsToMap in the ExecuteToolAsync.
await Geoprocessing.ExecuteToolAsync("management.CreateRandomPoints", createPointsParamsValueArray, null, CancelableProgressor.None, GPExecuteToolFlags.AddOutputsToMap);
Or does it result in nothing getting created? I return an IGPResult from my geoprocessing tasks to check if they're successful.
IGPResult createRandomPointsMessage = await Geoprocessing.ExecuteToolAsync("management.CreateRandomPoints", createPointsParamsValueArray, null, CancelableProgressor.None, GPExecuteToolFlags.AddOutputsToMap);
if (createRandomPointsMessage.IsFailed)
{
System.Diagnostics.Debug.WriteLine("Create random points errors");
}
I checked the file location,no shapefile (fishnet )was created.
The problem is solved, two parameters are added(origin_coord,y_axis_coord), and two parameters are modified(cell_width,cell_height).And delete this code:LayerFactory.Instance.CreateLayer(new Uri(out_feature_class), mapView.Map)