<?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: Novice needs Help Automating an Organized Workspace and Map Document in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/novice-needs-help-automating-an-organized/m-p/357796#M28242</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. You can try using &lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;A href="https://docs.python.org/2/library/functions.html#raw_input"&gt;raw_input()&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3. Use &lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;A href="http://pymotw.com/2/ospath/"&gt;os.path&lt;/A&gt;&lt;/SPAN&gt; to construct and deconstruct file paths.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Apr 2015 23:52:47 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2015-04-10T23:52:47Z</dc:date>
    <item>
      <title>Novice needs Help Automating an Organized Workspace and Map Document</title>
      <link>https://community.esri.com/t5/python-questions/novice-needs-help-automating-an-organized/m-p/357793#M28239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, this is day 3 of my Python experience and what I have so far works but results in a disorganized, cluttered mess in my map document.&amp;nbsp; I need to clean it up before I go any further and get things any more complicated.&amp;nbsp; I suspect I will shove a lot of questions into one blog post so I will number them as I go to make responding easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been reading about the os package and arcpy.mapping and arcpy.env and workspaces and default GDBs and things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: line-through;"&gt;So far, I have been writing my code in PyCharm and copy/pasting it into the ArcGIS Python window so I can check that it works.&amp;nbsp; &lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;EM&gt;&lt;SPAN style="background-color: #e4e4ff;"&gt;arcpy&lt;/SPAN&gt;.GetParameterAsText(&lt;SPAN style="color: #0000ff; text-decoration: line-through;"&gt;0&lt;/SPAN&gt;) &lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;does not ask for my input whether I run it in PyCharm or ArcGIS.&amp;nbsp; Is that something that only works when creating a script tool?&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Can you set the default GDB in python or is that something that HAS to happen when the map is created?&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Does &lt;EM&gt;os.makedirs() &lt;/EM&gt;accept a full file path or does it have to reference the current directory? I would like the user to input the .mxd file and use indexing to remove the .mxd extension to create a folder with the same name as the map document, and again to create a scratch folder.&amp;nbsp; ... And also I want to create a GDB with the same file path and name (for the default GDB). &lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; line-height: 1.5;"&gt;When running my scripts, I found that most of my files went into the default GDB but one went into my scratch folder.&amp;nbsp; Is there a rhyme or reason for determining where the intermediate files go?&amp;nbsp; I would like the useful files to go into the default GDB and the intermediate files to go into the scratch folder.&amp;nbsp; After the workspace is established, can I specify where I want created files to go in the workspace by shortening the file path to something like "/MapDocument/MapDocument.gdb/Polygon" or "MapDocument/scratch/Polygon"? where Polygon is the name of an intermediate shapefile?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: line-through; font-family: arial, helvetica, sans-serif;"&gt;Is there a way to stop the intermediate files from being added to the Map Document automatically?&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;As a follow up to number 5, if I turn automatic addition off in the environments, how do I add one to the map? &lt;EM&gt; Arcpy.mapping.AddLayer()&lt;/EM&gt; or something else?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Is there a way to add a group layer to the map without having to create a blank group layer and saving it and referencing it?&amp;nbsp; That does not seem good for automation. &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: line-through; font-family: arial, helvetica, sans-serif;"&gt;Similarly, how would I modify &lt;EM&gt;arcpy.mapping.MoveLayer()&lt;/EM&gt; to move a layer into a group layer? &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 18:56:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/novice-needs-help-automating-an-organized/m-p/357793#M28239</guid>
      <dc:creator>RachaelJohnson</dc:creator>
      <dc:date>2015-04-10T18:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Novice needs Help Automating an Organized Workspace and Map Document</title>
      <link>https://community.esri.com/t5/python-questions/novice-needs-help-automating-an-organized/m-p/357794#M28240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. Yes that is for getting input for a script tool.&lt;/P&gt;&lt;P&gt;2. You can set your workspace using arcpy.env.workspace here is a link for all environment controls &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000004s000000" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000004s000000"&gt;ArcGIS Help 10.1&lt;/A&gt; &lt;/P&gt;&lt;P&gt;3. Not familiar enough with the os module to help unfortunately.&amp;nbsp; I believe it can take a full file path&lt;/P&gt;&lt;P&gt;4. You can set a scratch workspace using the environment settings (See #2) as far as the rhyme or reason for a file going to scratch workspace vs default workspace, someone smarter can get to that.&lt;/P&gt;&lt;P&gt;5. You can set if outputs get added to map with environment settings (See #2)&amp;nbsp; look for arcpy.env.addOutputsToMap&lt;/P&gt;&lt;P&gt;6. From what I know, no there is not. &lt;/P&gt;&lt;P&gt;7. Use arcpy.mapping.AddLayerToGroup to add a layer to a group layer &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 19:13:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/novice-needs-help-automating-an-organized/m-p/357794#M28240</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-04-10T19:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Novice needs Help Automating an Organized Workspace and Map Document</title>
      <link>https://community.esri.com/t5/python-questions/novice-needs-help-automating-an-organized/m-p/357795#M28241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;2. The workspace is different from the default GDB though.&amp;nbsp; If I save a raster output, it goes into the workspace.&amp;nbsp; If I don't, it stays in the default GDB.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 19:29:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/novice-needs-help-automating-an-organized/m-p/357795#M28241</guid>
      <dc:creator>RachaelJohnson</dc:creator>
      <dc:date>2015-04-10T19:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Novice needs Help Automating an Organized Workspace and Map Document</title>
      <link>https://community.esri.com/t5/python-questions/novice-needs-help-automating-an-organized/m-p/357796#M28242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. You can try using &lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;A href="https://docs.python.org/2/library/functions.html#raw_input"&gt;raw_input()&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3. Use &lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;A href="http://pymotw.com/2/ospath/"&gt;os.path&lt;/A&gt;&lt;/SPAN&gt; to construct and deconstruct file paths.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2015 23:52:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/novice-needs-help-automating-an-organized/m-p/357796#M28242</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-04-10T23:52:47Z</dc:date>
    </item>
  </channel>
</rss>

