<?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: Save as Shapefile in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375048#M29634</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Claire, this or the stuff below might help you: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00120000003m000000" rel="nofollow noopener noreferrer" target="_blank"&gt;arcpy.featureClassToShapefile_conversion()&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James (just working off the top of my head - I think this is correct - will have to check it out tomorrow and get back to you), you can select the Routes simply by adding "\\Routes" to the end of the layer name, i.e.:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.Solve_na(outNALayer)
routes = outNALayer + '\\Routes'&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;then copy the selected routes to a new shapefile with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.Copy_management(routes, "C:\\output\\routesOutput.shp")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You may also want to look into &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;arcpy.CopyRows_management&lt;/STRONG&gt;&lt;SPAN&gt; as you are just interested in the table...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 17:20:54 GMT</pubDate>
    <dc:creator>StacyRendall1</dc:creator>
    <dc:date>2021-12-11T17:20:54Z</dc:date>
    <item>
      <title>Save as Shapefile</title>
      <link>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375045#M29631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm sure that this is a very simple question, but I can't find the answer unfortunately. I have wrote&amp;nbsp; a short Python script to do some geoprocessing, Network Analysis to be exact, and I want the routes that have been created from this process to be outputted as a Shapefile and saved to my PC - but using Python rather than right clicking and doing 'Data Export'. How do I go about this please? What is the Syntax?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 09:59:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375045#M29631</guid>
      <dc:creator>JamesSmith5</dc:creator>
      <dc:date>2011-09-27T09:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Save as Shapefile</title>
      <link>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375046#M29632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi James&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, I've managed to write the code that will loop through all your layers in the mxd remembering there names 'ListLayers' but I'm flumaxed as to how to export them.&amp;nbsp; The saveas property of Layer exports everything to a layer file rather than a shapefile.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sorry, I can't be more helpful.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Claire&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 14:31:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375046#M29632</guid>
      <dc:creator>ClaireParsons</dc:creator>
      <dc:date>2011-09-27T14:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Save as Shapefile</title>
      <link>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375047#M29633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi James&lt;BR /&gt;&lt;BR /&gt;Well, I've managed to write the code that will loop through all your layers in the mxd remembering there names 'ListLayers' but I'm flumaxed as to how to export them.&amp;nbsp; The saveas property of Layer exports everything to a layer file rather than a shapefile.&lt;BR /&gt;&lt;BR /&gt;sorry, I can't be more helpful.&lt;BR /&gt;&lt;BR /&gt;Claire&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hey Claire,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks loads for trying to help. To be honest, maybe I'm asking the wrong question. At the end of using Network Analyst I'm given a 'Route'. If I right click on this, I can view the attribute table of the Route (there is just one row in my example but there could be more if I was using the Closest Facility tool instead). This table has has attributes such as FirstStopID, LastStopID, RouteName etc. What I want to do is to save this table somewhere, so that the next piece of my Python code can access the fields and do some additional processing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone can suggest a way forward that would be great please.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 14:41:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375047#M29633</guid>
      <dc:creator>JamesSmith5</dc:creator>
      <dc:date>2011-09-27T14:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Save as Shapefile</title>
      <link>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375048#M29634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Claire, this or the stuff below might help you: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00120000003m000000" rel="nofollow noopener noreferrer" target="_blank"&gt;arcpy.featureClassToShapefile_conversion()&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James (just working off the top of my head - I think this is correct - will have to check it out tomorrow and get back to you), you can select the Routes simply by adding "\\Routes" to the end of the layer name, i.e.:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.Solve_na(outNALayer)
routes = outNALayer + '\\Routes'&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;then copy the selected routes to a new shapefile with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.Copy_management(routes, "C:\\output\\routesOutput.shp")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You may also want to look into &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;arcpy.CopyRows_management&lt;/STRONG&gt;&lt;SPAN&gt; as you are just interested in the table...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:20:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375048#M29634</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2021-12-11T17:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Save as Shapefile</title>
      <link>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375049#M29635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'll try this out later today - thank you very much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 08:19:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375049#M29635</guid>
      <dc:creator>JamesSmith5</dc:creator>
      <dc:date>2011-09-28T08:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Save as Shapefile</title>
      <link>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375050#M29636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some feedback...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;- arcpy.featureClassToShapefile_conversion("Sample_Routing\Routes", "E:\\")&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;This appears to work, but then says it had a problem naming the output. Which is odd, as this isn't even a parameter in the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;- arcpy.CopyFeatures_management("Sample_Routing\Routes", "test")&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I didn't think that this would work, but it does. It makes a shapefile of the Routes and saves them to the default location. Note, there's no need for .shp in the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;-arcpy.FeatureClassToFeatureClass_conversion(in_features, out_path, out_name)&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;- Although rather strangely named (how is feature to feature a conversion?), this also makes a shapefile as its output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So in summary, thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 09:26:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375050#M29636</guid>
      <dc:creator>JamesSmith5</dc:creator>
      <dc:date>2011-09-28T09:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Save as Shapefile</title>
      <link>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375051#M29637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Glad to hear it worked, James!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just one thing, I think you need either two back slashes or one forward slash in your paths, i.e.:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Sample_Routing\\Routes" or "Sample_Routing/Routes" not "Sample_Routing\Routes"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 17:27:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-as-shapefile/m-p/375051#M29637</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2011-09-28T17:27:13Z</dc:date>
    </item>
  </channel>
</rss>

