<?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 Is it possible to create a deepcopy from a feature class?  in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/is-it-possible-to-create-a-deepcopy-from-a-feature/m-p/839444#M3468</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the moment I have a python script to insert, update or delete features from a feature layer. This works well, but I have to upload the feature class containing the new records first to AGOL and publish it as a feature layer. This is because in order to update an existing feature layer, I have to create a deepcopy from the layer containing the new records, like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say my layer (with the new records) is named "updater_layer". I do a query on it, using a where clause :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;updater_layer_query = updater_layer.query(where=where_clause)&lt;/P&gt;&lt;P&gt;# I get the features:&amp;nbsp;&lt;/P&gt;&lt;P&gt;update_query_features = updater_layer_query.features&lt;/P&gt;&lt;P&gt;# and create a deepcopy which I can use to update an existing layer&lt;BR /&gt; new_features = deepcopy(update_query_features)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But to get those deepcopy records, I first have to upload and publish a new layer with new records to AGOL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am wondering if there is a way to do this on the desktop so that I end up with a deepcopy list from the feature class on the desktop, without having to upload the feature class first to AGOL as a feature layer. That deepcopy (derived from the feature class on the desktop) can then directly be used to update an existing feature layer in AGOL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked but it does not seem possible to create a deepcopy from a feature class. Is there a way to do this, perhaps via a JSON representation of the feature class or perhaps by using a searchcursor on the feature class? &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hugo&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Jan 2019 09:05:35 GMT</pubDate>
    <dc:creator>HugoBouckaert1</dc:creator>
    <dc:date>2019-01-08T09:05:35Z</dc:date>
    <item>
      <title>Is it possible to create a deepcopy from a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/is-it-possible-to-create-a-deepcopy-from-a-feature/m-p/839444#M3468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the moment I have a python script to insert, update or delete features from a feature layer. This works well, but I have to upload the feature class containing the new records first to AGOL and publish it as a feature layer. This is because in order to update an existing feature layer, I have to create a deepcopy from the layer containing the new records, like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say my layer (with the new records) is named "updater_layer". I do a query on it, using a where clause :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;updater_layer_query = updater_layer.query(where=where_clause)&lt;/P&gt;&lt;P&gt;# I get the features:&amp;nbsp;&lt;/P&gt;&lt;P&gt;update_query_features = updater_layer_query.features&lt;/P&gt;&lt;P&gt;# and create a deepcopy which I can use to update an existing layer&lt;BR /&gt; new_features = deepcopy(update_query_features)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But to get those deepcopy records, I first have to upload and publish a new layer with new records to AGOL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am wondering if there is a way to do this on the desktop so that I end up with a deepcopy list from the feature class on the desktop, without having to upload the feature class first to AGOL as a feature layer. That deepcopy (derived from the feature class on the desktop) can then directly be used to update an existing feature layer in AGOL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked but it does not seem possible to create a deepcopy from a feature class. Is there a way to do this, perhaps via a JSON representation of the feature class or perhaps by using a searchcursor on the feature class? &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hugo&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2019 09:05:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/is-it-possible-to-create-a-deepcopy-from-a-feature/m-p/839444#M3468</guid>
      <dc:creator>HugoBouckaert1</dc:creator>
      <dc:date>2019-01-08T09:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to create a deepcopy from a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/is-it-possible-to-create-a-deepcopy-from-a-feature/m-p/839445#M3469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found this ArcGIS API for Python sample notebook useful: &lt;A class="link-titled" href="https://developers.arcgis.com/python/sample-notebooks/updating-features-in-a-feature-layer/" title="https://developers.arcgis.com/python/sample-notebooks/updating-features-in-a-feature-layer/"&gt;updating_features_in_a_feature_layer | ArcGIS for Developers&lt;/A&gt; ; deepcopy from a AGOL feature layer is demonstrated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2019 17:12:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/is-it-possible-to-create-a-deepcopy-from-a-feature/m-p/839445#M3469</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-01-09T17:12:35Z</dc:date>
    </item>
  </channel>
</rss>

