<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: arcpy.mapping module problems. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461941#M36162</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the quick response Jason. As you can probably tell it was the end of the day when I wrote my problem so maybe I can clarify a bit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not interested in adding an output parameter to my script tool. For my purposes the script tool is a super simple GUI that will only ask the user for a few inputs. I have hard coded the names and locations of all of the outputs so I know where everything will end up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to try os.startfile (maybe i'll give it a shot this morning).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All that I am trying to accomplish is dumping the results of the script (5 rasters) into a blank MXD so that the user can take a look at the outputs and save the MXD if he or she chooses. They likely will not have and MXD open (which is why i was hoping to avoid using arcpy.mapping...) and will be running the script tool from catalog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help though!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jul 2012 15:02:44 GMT</pubDate>
    <dc:creator>ChrisBates1</dc:creator>
    <dc:date>2012-07-20T15:02:44Z</dc:date>
    <item>
      <title>arcpy.mapping module problems.</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461939#M36160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a few questions regarding the arcpy.mapping module that hopefully some of you can shed some light on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Is there any way to open a closed MXD using arcpy.mapping?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 21:58:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461939#M36160</guid>
      <dc:creator>ChrisBates1</dc:creator>
      <dc:date>2012-07-19T21:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping module problems.</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461940#M36161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The mapping module isn't what you want for your script tool if you're outputting new data to the current map. You'll want to &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Understanding_script_tool_parameters/001500000007000000/"&gt;add an output parameter of type raster layer or raster dataset into your script&lt;/A&gt;&lt;SPAN&gt;. Then it will add itself to the table of contents once it's done.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family:Courier New;"&gt;arcpy.mapping.MapDocument("current")&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;only&lt;/SPAN&gt;&lt;SPAN&gt; works from within ArcMap. That means that child process can't get to it either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If for some reason you really need to edit an MXD out of process and add things to it, then &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;&lt;A href="http://docs.python.org/release/2.6.8/library/os.html#os.startfile"&gt;os.startfile&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt; is what you'll want. &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;os.startfile(filename)&lt;/SPAN&gt;&lt;SPAN&gt; will behave in the same way as if you'd double clicked the file in Windows Explorer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm still not entirely sure as to what you are trying to accomplish. I think an output parameter is all you need here.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 00:08:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461940#M36161</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2012-07-20T00:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping module problems.</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461941#M36162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the quick response Jason. As you can probably tell it was the end of the day when I wrote my problem so maybe I can clarify a bit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not interested in adding an output parameter to my script tool. For my purposes the script tool is a super simple GUI that will only ask the user for a few inputs. I have hard coded the names and locations of all of the outputs so I know where everything will end up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to try os.startfile (maybe i'll give it a shot this morning).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All that I am trying to accomplish is dumping the results of the script (5 rasters) into a blank MXD so that the user can take a look at the outputs and save the MXD if he or she chooses. They likely will not have and MXD open (which is why i was hoping to avoid using arcpy.mapping...) and will be running the script tool from catalog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help though!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 15:02:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461941#M36162</guid>
      <dc:creator>ChrisBates1</dc:creator>
      <dc:date>2012-07-20T15:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping module problems.</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461942#M36163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Arcpy.mapping cannot add an element to a map document, but it can manipulate elements that are already present.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore, what you will want to do (to do it in arcpy.mapping), is to have an mxd prepared with place holding layers similar to the your yet-to-be-created output rasters, preferably with your prefered symbolization already applied.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can then identify the layer in the data frame by the name you have given it, and perform method operations like &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layer.replaceDataSource (to point the layer at your new raster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or toggle the layer.visible property (to turn off layers you don't need or turn on ones you want to show).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can also manipulate other layout elements other than the data frame: TEXT_ELEMENTs for instance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;These, again, have to already exist in the layout, but by using the elementPositionX and/or elementPositionY properties,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you can "puppet" them on of off the layout. (Say, add 100 to the elementPositionX to a text element you want to hide)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can, of course, modify the text of a text element, too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So arcpy.mapping is rather limited, but there is a good deal one can, with a bit of ingenuity, do within the limits.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;To make new elements, and add new layers, and whatnot, you will need ArcObjects &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; (You can still do it in VBA with or without ArcObjects by requesting a free VBA-in-Arc licence to use VBA in arc 10 or 10.1 (and no further))&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 16:09:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461942#M36163</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2012-07-20T16:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping module problems.</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461943#M36164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A slight correction to the last email.&amp;nbsp; It is correct in that arcpy.mapping can't create new MXDs but with arcpy.mapping you can add layers using the "AddLayer", "AddLayerToGroup", or InsertLayer" functions.&amp;nbsp; This would require having pre-authored layer files or a reference to a layer from another MXD.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 19:45:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-mapping-module-problems/m-p/461943#M36164</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2012-07-20T19:45:06Z</dc:date>
    </item>
  </channel>
</rss>

