I am using ArcObjects (ArcGIS 10.1) in .NET with some geoprocessing. It works great. There is an option to add the resulting feature class to the map. That works great too. However how do I get a reference to this layer to move it to a group layer?
Dim GP As GeoProcessor = New GeoProcessor
GP.AddOutputsToMap = True 'True if we want to add outputs to map, False if we dont.
Dim parameters As IVariantArray = New VarArray
parameters.Add(inDatasets)
parameters.Add(toPointFullName)
parameters.Add("")
Dim res As IGeoProcessorResult = GP.Execute("Merge_management", parameters, Nothing)
'todo: how do I get a reference to ILayer of the resulting layer added to map?
Hornbydd
44.9k5 gold badges42 silver badges84 bronze badges
asked May 29, 2015 at 21:43
1 Answer 1
The following in VBA shows how to create a layer object that you could then add to a group layer in the map.
Dim res As IGeoProcessorResult
If res.Status = esriJobSucceeded Then
Dim pGPUtil As IGPUtilities4
Set pGPUtil = New GPUtilities
Dim pFL As IFeatureLayer
Set pFL = pGPUtil.OpenFeatureLayerFromString(toPointFullName)
End If
answered May 30, 2015 at 15:55
-
Ahh didn't know u could do that. Let me give that a shot.sinDizzy– sinDizzy2015年05月30日 16:03:03 +00:00Commented May 30, 2015 at 16:03
-
Works great except I changed it to OpenFeatureClassFromString which gave me a feature class then i could turn that into a layer object. Thanks!sinDizzy– sinDizzy2015年06月01日 16:30:18 +00:00Commented Jun 1, 2015 at 16:30
Explore related questions
See similar questions with these tags.