I am creating a featureclass using the following code.
var result = await CreateLayer(System.IO.Path.GetDirectoryName(output), System.IO.Path.GetFileName(output), "POINT", SR.Wkid);
if (result == null) return;
var featurelayer = ?
public static async Task<IGPResult> CreateLayer(string path, string featureclassName, string featureclassType, int SR_wkid)
{
List<object> arguments = new List<object>
{
// store the results in the default geodatabase
//CoreModule.CurrentProject.DefaultGeodatabasePath,
path,
// name of the feature class
featureclassName,
// type of geometry
featureclassType,
// no template
"",
// no z values
"DISABLED",
// no m values
"DISABLED"
};
await QueuedTask.Run(() =>
{
// spatial reference
arguments.Add(SpatialReferenceBuilder.CreateSpatialReference(SR_wkid));
});
IGPResult result = await Geoprocessing.ExecuteToolAsync("CreateFeatureclass_management", Geoprocessing.MakeValueArray(arguments.ToArray()));
return result;
}CreateLayer automatically adds the featureclass to the map. How do I get a reference to this featurelayer? Is this the only way or can I get it directly from the IGResult?
var fcLayer = MapView.Active.Map.GetLayersAsFlattenedList().Where((l) => l.Name == fcName).FirstOrDefault() as BasicFeatureLayer;