<?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: Delete Field from Feature Layer in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-field-from-feature-layer/m-p/823258#M2895</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Hugo,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is how you would delete a field from a feature layer hosted in AGOL.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcgis
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gis &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; GIS

&lt;SPAN class="comment token"&gt;# Provide credentials to the GIS object.&lt;/SPAN&gt;
gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;username&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"your username"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; password&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"your password"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Get the id of the hosted feature layer&lt;/SPAN&gt;
item &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;get&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"id to the feature layer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Get the actual feature layer&lt;/SPAN&gt;
fl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; item&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layers&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#This is the JSON structure you need to pass in so that it knows what field to delete. &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# https://developers.arcgis.com/rest/services-reference/delete-from-definition-feature-layer-.htm&lt;/SPAN&gt;
json &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"fields"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"POP90_SQMI"&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; fl&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;manager&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;delete_from_definition&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;json&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;result&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:47:13 GMT</pubDate>
    <dc:creator>MunachisoOgbuchiekwe</dc:creator>
    <dc:date>2021-12-12T09:47:13Z</dc:date>
    <item>
      <title>Delete Field from Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-field-from-feature-layer/m-p/823257#M2894</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;I have been trying to delete a field from a feature layer. I have tried "delete_from_definition" and I get a success response, and yet the field (column) is still there afterwards:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I have a layer object, named updater_layer (it is definitely a feature layer object, I have checked its properties).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. I create the JSON that defines the column:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;status_remove = {&lt;BR /&gt; "name" : "STATUS", &lt;BR /&gt; "type" : "esriFieldTypeString", &lt;BR /&gt; "alias" : "Status", &lt;BR /&gt; "sqlType" : "sqlTypeOther", &lt;BR /&gt; "length" : 35, &lt;BR /&gt; "nullable" : 'true', &lt;BR /&gt; "editable" : 'true', &lt;BR /&gt; "domain" : 'null', &lt;BR /&gt; "defaultValue" : 'null'&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. I use:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;updater_layer.manager.delete_from_definition(&lt;SPAN&gt;status_remove)&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE style="color: #000000; background-color: #ffffff; border: 0px; font-size: 14px; padding: 1px 0px;"&gt;{'success': True}&lt;/PRE&gt;&lt;P&gt;but when I look at the properties i.e.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;updater_layer.manager.properties&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The STATUS field is still there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I remove a field from a feature layer in ArcGIS Online using the arcgis.gis API?&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;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2019 04:31:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-field-from-feature-layer/m-p/823257#M2894</guid>
      <dc:creator>HugoBouckaert1</dc:creator>
      <dc:date>2019-03-15T04:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Field from Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-field-from-feature-layer/m-p/823258#M2895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Hugo,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is how you would delete a field from a feature layer hosted in AGOL.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcgis
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gis &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; GIS

&lt;SPAN class="comment token"&gt;# Provide credentials to the GIS object.&lt;/SPAN&gt;
gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;username&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"your username"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; password&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"your password"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Get the id of the hosted feature layer&lt;/SPAN&gt;
item &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;get&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"id to the feature layer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Get the actual feature layer&lt;/SPAN&gt;
fl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; item&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layers&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#This is the JSON structure you need to pass in so that it knows what field to delete. &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# https://developers.arcgis.com/rest/services-reference/delete-from-definition-feature-layer-.htm&lt;/SPAN&gt;
json &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"fields"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"POP90_SQMI"&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; fl&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;manager&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;delete_from_definition&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;json&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;result&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:47:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-field-from-feature-layer/m-p/823258#M2895</guid>
      <dc:creator>MunachisoOgbuchiekwe</dc:creator>
      <dc:date>2021-12-12T09:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Field from Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-field-from-feature-layer/m-p/1130625#M6968</link>
      <description>&lt;P&gt;i am sorry an still new in this. Where i can run this code. can you please tell me what to do.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 22:44:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/delete-field-from-feature-layer/m-p/1130625#M6968</guid>
      <dc:creator>OussamaMerhi</dc:creator>
      <dc:date>2022-01-04T22:44:20Z</dc:date>
    </item>
  </channel>
</rss>

