In ArcObjects, I commonly used MakeFeatureLayer to create a layer from a Feature Class, which I then worked with further, for example for spatial selections. When I try to do the same thing in ArcGIS Pro, I get the following error message: ERROR 000732: Selecting Features: Dataset Extent_lyr does not exist or is not supported.
await QueuedTask.Run(async () =>
{
string pathToFgdb = @"C:\ISSMD\Temp\Masking.gdb";
string nameExtent = "Extent";
string nameMasks= "Masks";
string pathToFcExtent = Path.Combine(pathToFgdb, nameExtent);
string pathToFcMasks = Path.Combine(pathToFgdb, nameMasks);
var layerNameExtent = nameExtent + "_lyr";
var layerNameMasks = nameMasks + "_lyr";
var args1 = Geoprocessing.MakeValueArray(pathToFcExtent, layerNameExtent);
IGPResult result1 = await Geoprocessing.ExecuteToolAsync("management.MakeFeatureLayer", args1, null, null, null, GPExecuteToolFlags.AddToHistory);
var args2 = Geoprocessing.MakeValueArray(pathToFcMasks, layerNameMasks);
IGPResult result2 = await Geoprocessing.ExecuteToolAsync("management.MakeFeatureLayer", args2, null, null, null, GPExecuteToolFlags.AddToHistory);
IGPResult result3 = await GeoProcesy.GeoprocessingovaUlohaVysledek("management.SelectLayerByLocation",
[layerNameMasks, "INTERSECT", layerNameExtent, "", "NEW_SELECTION", "NOT_INVERT"]);
});
}So is it even possible to do it this way or do I have to do it only like this?
FeatureLayer featureLayer = LayerFactory.Instance.CreateLayer<FeatureLayer>(featureLayerParams, map);