cbates0372

arcpy.mapping module problems.

Discussion created by cbates0372 on Jul 19, 2012
Latest reply on Jul 20, 2012 by jbarrette-esristaff
Hi All!

I have a few questions regarding the arcpy.mapping module that hopefully some of you can shed some light on.

I am currently working on a project for a fairly complicated raster processes for some non-GIS type people. As such I burried the script in a script tool to make it user friendly. Some have asked that once the process is complete - I output the resulting raster dataset into an ArcMap Document (MXD). It seems like this can be done using the mapping module, but alas issues keep coming up.

1. Do I have to have an MXD created before I can dump the outputs into it? I would love to open ArcMap using something like: subprocess.Popen([arcmap]) where arcmap is the path to the .exe. But then when I try refering to the document as: arcpy.mapping.MapDocument("CURRENT") it doesn't seem to recognize the document.

2. If I have to create a default MXD I will. but I would like to see the raster I add to the TOC without saving the document (it will be read only). Instead I have to use: mxd.saveACopy(mxdoutput) to see the rasters in the TOC, and I would rather the users just decide where they want to save the map to.

3. Is there any way to open a closed MXD using arcpy.mapping?

4. If i can't open a closed MXD and have to use subprocess.Popen to open ArcMap. I think I have to use Popen.wait to keep the process from killing itself. Is there anyway to set up some checks so that the script with stop waiting?

Chris

Outcomes