5

I have a collection of rasters that I'm writing code to automate clipping based on a user defined shapefile. I am currently doing this in the Python window using the following as the main processing function:

arcpy.Clip_management( inputRasterFilename, "#", outputRasterFilename, "shapefile" )

Basically I want to read the raster, clip it, and have it saved to outputRasterFilename for later use.

This is exactly what happens except that ArcGIS also adds the result of clip operation to the current map that I have open. Is there a way to disable this?

2
  • This post on ESRI's forums asks the equivalent question of a way to do this programmatically using Python. The OP seems to indicate this was available in 9.3 via arcgisscripting and now he wants to do it in 10.0 via arcpy. Jun 22, 2011 at 16:53
  • This post on ESRI's forums gives a good workaround: always have the dialog disable and use the AddLayer function in the arcpy.mapping module to add outputs as needed. Jun 22, 2011 at 17:04

3 Answers 3

14

With ArcGIS 10.1 it is possible to disable add output to the application display with arcpy.env.addOutputsToMap = False http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000004s000000

10

You can change this setting in the MXD by clicking Geoprocessing|Geoprocessing Options and unclicking "Add results of geoprocessing operations to the display".

2
  • Thanks! Is there a way to set this programmatically? Jun 21, 2011 at 20:02
  • I know how to set it in .NET, but I don't know Python well enough yet for the correct syntax.
    – kenbuja
    Jun 21, 2011 at 20:05
1

Here is ESRI's documentation for doing it in .NET:

1
  • 1
    -1: This has nothing to do with what the OP requested since they're using arcpy. They don't have access to the IGeoProcessor namespace (or any other .Net namespace, for that matter). Furthermore, it's not really "documentation for doing it", it's a link to a method that allows or disallows adding outputs within ArcObjects. Jun 27, 2011 at 21:40

Your Answer

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

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