<?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: learning python, using python how would I ingest feature classes into a GDB, then rename them in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/learning-python-using-python-how-would-i-ingest/m-p/1248654#M66579</link>
    <description>&lt;P&gt;To do that, you can use the tool&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/conversion/export-features.htm" target="_blank" rel="noopener"&gt;Export Features (Conversion)—ArcGIS Pro | Documentation.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The documentation of the ArcGIS Tools always has a section which tells you how to call the tool in Python:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1673959139707.png" style="width: 570px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60544iC2F8909BEC6B7664/image-dimensions/570x327?v=v2" width="570" height="327" role="button" title="JohannesLindner_0-1673959139707.png" alt="JohannesLindner_0-1673959139707.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know your data, but here are two quick examples:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just copy the whole feature class&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.conversion.ExportFeatures(
    "C:/Data/OldGeodatabase.gdb/Buildings",
    "C:/Data/NewGeodatabase.gdb/Buildings"
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy the features into different Featureclasses, depending on a field value&lt;/P&gt;&lt;LI-CODE lang="python"&gt;in_features = "C:/Data/OldGeodatabase/Buildings"
classification_field = "Country"

# read all values of the classification field
class_values = []
with arcpy.da.SearchCursor(in_features, [classification_field]) as cursor:
    for row in cursor:
        class_values.append(row[0])

# often, you will find syntax like this:
# class_values = [row[0] for row in arcpy.da.SearchCursor(in_features, [classification_field])]
# this is called list comprehension, lots of good intros into that online.

# convert the list (all values) into a set (distinct values)
distinct_class_values = set(class_values)

# loop over the distinct values
for class_value in distinct_class_values:
    print(class_value)
    # create a SQL query that will filter for that value
    query = f"{classification_field} = '{class_value}'"  # this is called f-string
    # export the filtered features into a new feature class
    arcpy.converion.ExportFeatures(
        in_features,
        f"C:/Data/NewGeodatabase.gdb/{class_value}_Buildings",
        query
        )
    &lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 17 Jan 2023 12:53:38 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2023-01-17T12:53:38Z</dc:date>
    <item>
      <title>learning python, using python how would I ingest feature classes into a GDB, then rename them</title>
      <link>https://community.esri.com/t5/python-questions/learning-python-using-python-how-would-i-ingest/m-p/1248529#M66575</link>
      <description>&lt;P&gt;Using Python, how would I take for example [ buildings_a_16_free] from osm and ingest that feature class into a new GDB (named after a file structure such as ***- where *** is the name of the country) into [***_Buildings_Polygon]?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I figure it out first I will post the solution to it.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 19:05:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/learning-python-using-python-how-would-i-ingest/m-p/1248529#M66575</guid>
      <dc:creator>Emasia</dc:creator>
      <dc:date>2023-01-16T19:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: learning python, using python how would I ingest feature classes into a GDB, then rename them</title>
      <link>https://community.esri.com/t5/python-questions/learning-python-using-python-how-would-i-ingest/m-p/1248654#M66579</link>
      <description>&lt;P&gt;To do that, you can use the tool&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/conversion/export-features.htm" target="_blank" rel="noopener"&gt;Export Features (Conversion)—ArcGIS Pro | Documentation.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The documentation of the ArcGIS Tools always has a section which tells you how to call the tool in Python:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1673959139707.png" style="width: 570px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60544iC2F8909BEC6B7664/image-dimensions/570x327?v=v2" width="570" height="327" role="button" title="JohannesLindner_0-1673959139707.png" alt="JohannesLindner_0-1673959139707.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know your data, but here are two quick examples:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just copy the whole feature class&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.conversion.ExportFeatures(
    "C:/Data/OldGeodatabase.gdb/Buildings",
    "C:/Data/NewGeodatabase.gdb/Buildings"
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy the features into different Featureclasses, depending on a field value&lt;/P&gt;&lt;LI-CODE lang="python"&gt;in_features = "C:/Data/OldGeodatabase/Buildings"
classification_field = "Country"

# read all values of the classification field
class_values = []
with arcpy.da.SearchCursor(in_features, [classification_field]) as cursor:
    for row in cursor:
        class_values.append(row[0])

# often, you will find syntax like this:
# class_values = [row[0] for row in arcpy.da.SearchCursor(in_features, [classification_field])]
# this is called list comprehension, lots of good intros into that online.

# convert the list (all values) into a set (distinct values)
distinct_class_values = set(class_values)

# loop over the distinct values
for class_value in distinct_class_values:
    print(class_value)
    # create a SQL query that will filter for that value
    query = f"{classification_field} = '{class_value}'"  # this is called f-string
    # export the filtered features into a new feature class
    arcpy.converion.ExportFeatures(
        in_features,
        f"C:/Data/NewGeodatabase.gdb/{class_value}_Buildings",
        query
        )
    &lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 Jan 2023 12:53:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/learning-python-using-python-how-would-i-ingest/m-p/1248654#M66579</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-01-17T12:53:38Z</dc:date>
    </item>
  </channel>
</rss>

