0

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

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
2
  • Ahh didn't know u could do that. Let me give that a shot. Commented 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! Commented Jun 1, 2015 at 16:30

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.