I'm making a geoprocessing tool with the ArcObjects SDK Java 10.2. I need to modify labeling colors of a layer of the current map. Is it possible from the execute function to access the map currently opened in ArcMap ? I need to get the current IMapDocument or IMap in order to set up parameters of the layers (IGeoFeatureLayer). How can I do that please ?

2 Answers 2


You can use getMap() or getMapLayers() methods of the GPUtilities class. Note that this can return null depending on how and where your geoprocessing tool is run.

If you need to specify rendering of an output layer, I believe the correct way to do that is to implement IGPFunction2.getRenderer() method on your GP function class.

  • Yes, as my geoprocessing tool extends a BaseGeoprocessingTool, I can access a gpUtilities object and then get the activeView or map if the gp tool is launched in an ArcMap environnement. Thanks a lot for this help !
    – superrache
    Commented Feb 18, 2014 at 12:51

.Net function to return the current active IMap, not sure if you can adapt this for java... good luck!

Public Function GetMapFromArcMap(ByVal application As ESRI.ArcGIS.Framework.IApplication) As ESRI.ArcGIS.Carto.IMap

  Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument = CType(application.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument) ' Explicit Cast
  Dim activeView As ESRI.ArcGIS.Carto.IActiveView = mxDocument.ActiveView
  Dim map As ESRI.ArcGIS.Carto.IMap = activeView.FocusMap

  Return map

End Function

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.