<?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: What does Copy Feature tool returns? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/what-does-copy-feature-tool-returns/m-p/1172980#M64531</link>
    <description>&lt;P&gt;I think i found a solution to my question.&amp;nbsp; Here is the code:&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;arcpy.env.overwriteOutput = True&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;arcpy.env.workspace = 'in_memory'&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;global lineFeature&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;global pointFeature&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;currentmap = aprx.activeMap&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;layers = currentmap.listLayers()&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;for lyr in layers:&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;if lyr.getSelectionSet():&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;print (lyr.name)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;oid =lyr.getSelectionSet()&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;print (oid)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;desc = arcpy.Describe(lyr)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;if desc.shapeType == "Polyline":&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;print ("Polyline")&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;lineFeature=arcpy.management.CopyFeatures(lyr, "SplitFeature")&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;elif desc.shapeType == "Point":&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;pointFeature =arcpy.management.CopyFeatures(lyr, "PointFeature")&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;print ("Point")&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;fields=arcpy.ListFields(lineFeature)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;cursor=arcpy.SearchCursor(lineFeature)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;for row in cursor:&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;printf=str(row.getValue("DRAINAGE_ID"))&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;print("DRAINAGE_ID=="+printf)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;del row, cursor&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2022 19:15:37 GMT</pubDate>
    <dc:creator>YinghongLi1</dc:creator>
    <dc:date>2022-05-11T19:15:37Z</dc:date>
    <item>
      <title>What does Copy Feature tool returns?</title>
      <link>https://community.esri.com/t5/python-questions/what-does-copy-feature-tool-returns/m-p/1172974#M64530</link>
      <description>&lt;P&gt;I used this syntax to do copy feature task:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;lineFeature=arcpy.management.CopyFeatures(lyr, "SplitFeature")&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I do not know what data type is the lineFeature after the copy feature tool finishes running.&lt;/P&gt;&lt;P&gt;I can use list fields function on it and i can get count of the feature from it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;lineCount = arcpy.GetCount_management(lineFeature)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;fields=arcpy.ListFields(lineFeature)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;for field in fields:&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; print("{0} is a type of {1} with a length of {2}".format(field.name, field.type, field.length))&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Now I&amp;nbsp;want to get values from the fields.&amp;nbsp; How should I do it?&amp;nbsp; Do i need to use a search cursor?&amp;nbsp; Then what do I&amp;nbsp;use to search?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 18:59:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/what-does-copy-feature-tool-returns/m-p/1172974#M64530</guid>
      <dc:creator>YinghongLi1</dc:creator>
      <dc:date>2022-05-11T18:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: What does Copy Feature tool returns?</title>
      <link>https://community.esri.com/t5/python-questions/what-does-copy-feature-tool-returns/m-p/1172980#M64531</link>
      <description>&lt;P&gt;I think i found a solution to my question.&amp;nbsp; Here is the code:&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;arcpy.env.overwriteOutput = True&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;arcpy.env.workspace = 'in_memory'&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;global lineFeature&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;global pointFeature&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;currentmap = aprx.activeMap&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;layers = currentmap.listLayers()&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;for lyr in layers:&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;if lyr.getSelectionSet():&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;print (lyr.name)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;oid =lyr.getSelectionSet()&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;print (oid)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;desc = arcpy.Describe(lyr)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;if desc.shapeType == "Polyline":&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;print ("Polyline")&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;lineFeature=arcpy.management.CopyFeatures(lyr, "SplitFeature")&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;elif desc.shapeType == "Point":&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;pointFeature =arcpy.management.CopyFeatures(lyr, "PointFeature")&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;&lt;EM&gt;print ("Point")&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;fields=arcpy.ListFields(lineFeature)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;cursor=arcpy.SearchCursor(lineFeature)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;for row in cursor:&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;printf=str(row.getValue("DRAINAGE_ID"))&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;print("DRAINAGE_ID=="+printf)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;EM&gt;del row, cursor&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 19:15:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/what-does-copy-feature-tool-returns/m-p/1172980#M64531</guid>
      <dc:creator>YinghongLi1</dc:creator>
      <dc:date>2022-05-11T19:15:37Z</dc:date>
    </item>
  </channel>
</rss>

