<?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: Writing a ArcPy script to create layer from selected features at end of geo-model in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619059#M20564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Would it be something like this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Name: createlayerfromselectedfeatures.py
# Description:&amp;nbsp; creates a new layer based on a query.
# Author: RFurlong


import arcpy
from arcpy import env


arcpy.overwriteOutput = true


try:

&amp;nbsp;&amp;nbsp; # Make a layer from the feature class
&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management("C:/data/test.gdb/blockgroups_lyr")

&amp;nbsp;&amp;nbsp; # Write the selected features to a new layer
&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("blockgroups", "c:/data/test.gdb/blockgroups")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:26:35 GMT</pubDate>
    <dc:creator>RyanFurlong</dc:creator>
    <dc:date>2021-12-12T02:26:35Z</dc:date>
    <item>
      <title>Writing a ArcPy script to create layer from selected features at end of geo-model</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619058#M20563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have created a geo-processing model that does a 14 min drive time around a point then selects all block groups within that drive time area.&amp;nbsp; As of now I have to right click in the table of contents to turn the selection into a layer while I would rather have that done automatically at the end of the model.&amp;nbsp; How do I script this in ArcPy?&amp;nbsp; I thank you in advanced for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Aug 2010 15:08:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619058#M20563</guid>
      <dc:creator>RyanFurlong</dc:creator>
      <dc:date>2010-08-11T15:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Writing a ArcPy script to create layer from selected features at end of geo-model</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619059#M20564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Would it be something like this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Name: createlayerfromselectedfeatures.py
# Description:&amp;nbsp; creates a new layer based on a query.
# Author: RFurlong


import arcpy
from arcpy import env


arcpy.overwriteOutput = true


try:

&amp;nbsp;&amp;nbsp; # Make a layer from the feature class
&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management("C:/data/test.gdb/blockgroups_lyr")

&amp;nbsp;&amp;nbsp; # Write the selected features to a new layer
&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("blockgroups", "c:/data/test.gdb/blockgroups")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:26:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619059#M20564</guid>
      <dc:creator>RyanFurlong</dc:creator>
      <dc:date>2021-12-12T02:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Writing a ArcPy script to create layer from selected features at end of geo-model</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619060#M20565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a similar problem I have created a simple model in Arcmap Arcgis9.3,&amp;nbsp; I have reached the penultimate stage which is to select polygons by location however I cannot find a tool in the system toolbox that will export the selection to a layer file. In other stages of the model i have used the select tool to export selections based on attributes but i cant seem to find a similar feature for selections based on location?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I missing?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jan 2011 18:52:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619060#M20565</guid>
      <dc:creator>TimPhillips</dc:creator>
      <dc:date>2011-01-10T18:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Writing a ArcPy script to create layer from selected features at end of geo-model</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619061#M20566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Save_To_Layer_File/001700000070000000/"&gt;Save To Layer File&lt;/A&gt;&lt;SPAN&gt; tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To select features based on location, use the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Select_Layer_By_Location/001700000072000000/"&gt;Select Layer By Location&lt;/A&gt;&lt;SPAN&gt; tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm pretty sure you'll find everything you need in the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/An_overview_of_the_Layers_and_Table_Views_toolset/00170000006m000000/"&gt;Layers and Table Views&lt;/A&gt;&lt;SPAN&gt; toolset.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jan 2011 22:34:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619061#M20566</guid>
      <dc:creator>DaleHoneycutt</dc:creator>
      <dc:date>2011-01-10T22:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Writing a ArcPy script to create layer from selected features at end of geo-model</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619062#M20567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there python script to select all of the features on the screen?&amp;nbsp; I know there is a tool for it by searching for it through the Customize menu, but is there a way to script the function?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jan 2011 14:52:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/writing-a-arcpy-script-to-create-layer-from/m-p/619062#M20567</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2011-01-19T14:52:22Z</dc:date>
    </item>
  </channel>
</rss>

